function _custom_breadcrumbs_menu_index in Custom Breadcrumbs 7.2
Same name and namespace in other branches
- 6.2 custom_breadcrumbs.module \_custom_breadcrumbs_menu_index()
Menu Index.
Indexes the menu tree by mlid. This is needed to identify the items without relying on titles.
This function is recursive.
@codingStandardsIgnoreStart
Parameters
array $tree: A tree of menu items such as the return value of menu_tree_all_data().
Return value
array 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 - Menu Subtree.
File
- ./
custom_breadcrumbs.module, line 1196 - Main file for the Custom breadcrumbs.
Code
function _custom_breadcrumbs_menu_index($tree, $ancestors = array(), $parent = NULL) {
// @codingStandardsIgnoreEnd
$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;
}