function _custom_breadcrumbs_menu_index in Custom Breadcrumbs 6.2
Same name and namespace in other branches
- 7.2 custom_breadcrumbs.module \_custom_breadcrumbs_menu_index()
Indexes the menu tree by mlid. This is needed to identify the items without relying on titles.
This function is recursive.
Parameters
$tree: A tree of menu items such as the return value of menu_tree_all_data().
Return value
An array associating mlid values with the internal keys of the menu tree.
1 call to _custom_breadcrumbs_menu_index()
- _custom_breadcrumbs_menu_subtree in ./
custom_breadcrumbs.module - Traverses the menu tree and returns the sub-tree of the item indicated by the parameter.
File
- ./
custom_breadcrumbs.module, line 1054 - Provide custom breadcrumbs for node-type pages and base functionality for submodules to add custom breadcrumbs for other types of pages.
Code
function _custom_breadcrumbs_menu_index($tree, $ancestors = array(), $parent = NULL) {
$index = array();
if ($parent) {
$ancestors[] = $parent;
}
foreach ($tree as $key => $item) {
$index[$item['link']['mlid']] = array(
'key' => $key,
'parents' => $ancestors,
);
if (!empty($item['below'])) {
$index += _custom_breadcrumbs_menu_index($item['below'], $ancestors, $item['link']['mlid']);
}
}
return $index;
}