1

I have created a menu that has a handful of top level items and some sub-menu items. it is similar in structure to my "main menu". It is my understanding that each top level menu item is an array, which also contains an array of menu items that are "below" that menu item.

When I print out the array of the menu it will not show the sub-menu items. Am I doing something wrong?

$mm = menu_tree_page_data('menu-second-menu');
print_r($mm);

My ultimate goal is creating X amount of individual menus, and display them in various places throughout the theme.

When I print the array values for the "Main Menu", which is assigned to a block and working, I do see the sub-menu items right where I'd expect them to be.

2
  • Upgrading to the latest version of drupal (7.12) seems to get me a little closer.. the array does get the right values in it now. I will post again when I have confirmed all is working. edit: yes. appears to be working. the upgrade fixed/changed something. I didn't see any bug reports while googling.
    – jdu
    Commented Mar 27, 2012 at 17:14
  • Hint: The block menu module (drupal.org/project/menu_block) does this, considering using that instead of writing custom code.
    – Berdir
    Commented Aug 2, 2012 at 15:58

2 Answers 2

2

If you want the whole array of the menu use this function,

menu_tree_all_data('MENU_NAME');

If you find any difficulty, please let me know!

0
0

But isn't menu_tree_page_data() suppose to do the task as well? If it doesn't we need to know why so we can address the issue right to the cause of the problem. I am using i18n_menu_translated_tree() and apparently it is also using menu_tree_page_data() to call the menu. But due to this factor, my translated menu is not showing properly (i.e. submenu not shown).

Anyone who has knowledge on this issue kindly share. Thanks in advance.

1
  • This isn't an answer to the question but another question -- please move this to the comments section or ask it as another issue entirely.
    – schnippy
    Commented Nov 5, 2012 at 19:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.