I just want to add my experience to the lot. I had similar issues using Drupal menu. The solution I used is:
- Set all menu items with children to "Expanded". This as to be done manually:
Structure > Menus > List links
, edit links which has children, check theShow as expanded
checkbox. - Use
menu_tree_page_data
function (example:$menu_tree = menu_tree_page_data('main_menu''main-menu')
) to get the menu, with all its children AND with active trail. - Create a renderable array using
menu_tree_output
function (example:$renderable_array = menu_tree_output($menu_tree)
) to prepare the menu for rendering. - Use the renderable array as content for my custom block, but you could call
drupal_render($renderable_array)
to get the rendered HTML representing the menu.