function _custom_breadcrumbs_menu_subtree in Custom Breadcrumbs 7.2
Same name and namespace in other branches
- 6.2 custom_breadcrumbs.module \_custom_breadcrumbs_menu_subtree()
Menu Subtree.
Traverses the menu tree and returns the sub-tree of the item indicated by the parameter.
@codingStandardsIgnoreStart
Parameters
array $item: Item.
Return value
array The items below the lowest item in the stack.
1 call to _custom_breadcrumbs_menu_subtree()
- custom_breadcrumbs_theme_menu_item in ./
custom_breadcrumbs.module - Theme Menu Item.
File
- ./
custom_breadcrumbs.module, line 1157 - Main file for the Custom breadcrumbs.
Code
function _custom_breadcrumbs_menu_subtree($item) {
// @codingStandardsIgnoreEnd
static $index = array();
static $indexed = array();
// This looks expensive, but menu_tree_all_data uses static caching.
$tree = menu_tree_all_data($item['menu_name']);
if (!isset($indexed[$item['menu_name']])) {
$index += _custom_breadcrumbs_menu_index($tree);
$indexed[$item['menu_name']] = TRUE;
}
// Traverse the tree.
foreach ($index[$item['mlid']]['parents'] as $mlid) {
$key = $index[$mlid]['key'];
if (!isset($tree[$key])) {
return array();
}
$tree = $tree[$key]['below'];
}
$key = $index[$item['mlid']]['key'];
return isset($tree[$key]) ? $tree[$key]['below'] : array();
}