function menu_tree_trim_active_path in Menu Block 6.2
Same name and namespace in other branches
- 7.3 menu_block.module \menu_tree_trim_active_path()
- 7.2 menu_block.module \menu_tree_trim_active_path()
Trim everything but the active trail in the tree.
Parameters
$tree: array The menu tree to trim.
Return value
void
1 call to menu_tree_trim_active_path()
- menu_tree_build in ./
menu_block.module - Build a menu tree based on the provided configuration.
File
- ./
menu_block.module, line 464 - Provides configurable blocks of menu items.
Code
function menu_tree_trim_active_path(&$tree) {
foreach (array_keys($tree) as $key) {
if (($tree[$key]['link']['in_active_trail'] || $tree[$key]['link']['expanded']) && $tree[$key]['below']) {
// Continue in the subtree, if it exists.
menu_tree_trim_active_path($tree[$key]['below']);
}
else {
// Trim anything not expanded or along the active trail.
$tree[$key]['below'] = FALSE;
}
}
}