function _megamenu_get_menu_tree in Megamenu 6
Same name and namespace in other branches
- 6.2 megamenu.utilities.inc \_megamenu_get_menu_tree()
- 7 megamenu.utilities.inc \_megamenu_get_menu_tree()
Retrieve a menu and pre-style before theming
This function currently removes all "hidden" items, which could be handled in the single iteration of the theme function. But, I forsee a need for other prep work that might be simmplfied with this second function
Will be used in the future to add/alter attributes prior to theming
Parameters
$menuname: The name of the menu to extract
Return value
The pre-styled menu tree
1 call to _megamenu_get_menu_tree()
- megamenu_theme_menu_tree in ./
megamenu.module - Theme a menu tree
File
- ./
megamenu.utilities.inc, line 45 - Helper/utility functions
Code
function _megamenu_get_menu_tree($menuname) {
$menutree = menu_tree_all_data($menuname);
foreach ($menutree as $t1key => $branch) {
if ($branch['link']['hidden'] == 1) {
unset($menutree[$t1key]);
}
else {
if ($branch['below']) {
foreach ($branch['below'] as $t2key => $twig) {
if ($twig['link']['hidden'] == 1) {
unset($menutree[$t1key]['below'][$t2key]);
}
else {
if ($twig['below']) {
foreach ($twig['below'] as $t3key => $leaf) {
if ($leaf['link']['hidden'] == 1) {
unset($menutree[$t1key]['below'][$t2key]['below'][$t3key]);
}
else {
if ($leaf['below']) {
unset($menutree[$t1key]['below'][$t2key]['below'][$t3key]['below']);
}
}
}
//end t3 iteration
}
}
}
//end t2 iteration
}
}
}
//end t1 iteration
return $menutree;
}