| 1 system.api.php | hook_menu_block_tree_alter(&$tree, &$config) |
Modify a menu structure before it is rendered in a menu block.
The tree contains an array of menu links in the order they should be rendered. menu_tree_page_data() explains the data structure in more detail.
Parameters
array $tree: An array of menu links.
array $config: The settings for a menu block.
See also
Related topics
File
- core/
modules/ system/ system.api.php, line 1241 - Hooks provided by Backdrop core and the System module.
Code
function hook_menu_block_tree_alter(&$tree, &$config) {
// Trim to the active path regardless of block settings.
system_menu_tree_trim_active_path($tree);
// Force the style to be a tree.
$config['style'] = 'tree';
}