- admin_menu_output in contributions/admin_menu/admin_menu.module
- Build the administration menu output.
admin_menu_tree()admin_menu_tree($menu_name)Build the full administration menu tree from static and expanded dynamic items.
$menu_name The menu name to use as base for the tree.
contributions/admin_menu/admin_menu.inc, line 14
<?php
function admin_menu_tree($menu_name) {
// Get placeholder expansion arguments from hook_admin_menu_map()
// implementations.
module_load_include('inc', 'admin_menu', 'admin_menu.map');
$expand_map = module_invoke_all('admin_menu_map');
// Allow modules to alter the expansion map.
drupal_alter('admin_menu_map', $expand_map);
$new_map = array();
$hidden = array();
foreach ($expand_map as $path => $data) {
// Convert named placeholders to anonymous placeholders, since the menu
// system stores paths using anonymous placeholders.
// @todo Why specify named placeholders in the first place then?
$replacements = array_fill_keys(array_keys($data['arguments'][0]), '%');
$data['parent'] = strtr($data['parent'], $replacements);
$new_map[strtr($path, $replacements)] = $data;
// Collect paths to hide.
if (isset($data['hide'])) {
$hidden[strtr($data['hide'], $replacements)] = 1;
}
}
$expand_map = $new_map;
unset($new_map);
// Retrieve dynamic menu link tree for the expansion mappings.
$tree_dynamic = admin_menu_tree_dynamic($expand_map);
// Merge local tasks with static menu tree.
$tree = menu_tree_all_data($menu_name);
admin_menu_merge_tree($tree, $tree_dynamic, array(), $hidden);
return $tree;
}
?>