public function ExpandedSetting::alterTree in Menu Bean 7
Alters the menu tree
Parameters
array $tree:
\Bean $bean:
Return value
array
Overrides SettingInterface::alterTree
File
- lib/
Drupal/ menu_bean/ Setting/ ExpandedSetting.php, line 34 - Level Plugin class
Class
Namespace
Drupal\menu_bean\SettingCode
public function alterTree(array &$tree, \Bean $bean) {
// Get the menu
if ($bean->expanded) {
// Get the full, un-pruned tree.
$tree_array = menu_tree_all_data($bean->menu_name);
// And add the active trail data back to the full tree.
menu_bean_tree_add_active_path($tree);
}
else {
// Get the tree pruned for just the active trail.
$tree_array = menu_tree_page_data($bean->menu_name);
}
return $tree_array;
}