function simplemenu_compact_menu_tree in SimpleMenu 6.2
Recursive function to compact the menu tree into our item_list style tree
Parameters
$tree: A menu tree array as returned from menu_tree_all_data().
Return value
A tree array ready for simplemenu_tree_output().
1 call to simplemenu_compact_menu_tree()
- simplemenu_menu_tree in ./
simplemenu.module - Custom implementation of menu_tree(). We want to retrieve the entire menu structure for a given menu, regardless of whether or not the menu item is expanded or not.
File
- ./
simplemenu.module, line 265 - Creates a simplemenu.
Code
function simplemenu_compact_menu_tree($tree) {
$items = array();
foreach ($tree as $data) {
if (!$data['link']['hidden']) {
$link = $data['link'];
if (empty($link['localized_options'])) {
$link['localized_options'] = array();
}
unset($link['localized_options']['attributes']['title']);
$link = l($link['title'], $link['href'], $link['localized_options']);
if ($data['below']) {
$items[] = array(
'data' => $link,
'children' => simplemenu_compact_menu_tree($data['below']),
);
}
else {
$items[] = $link;
}
}
}
return $items;
}