function _admin_menu_tree in Administration menu 7.3
Build the full administration menu tree from static and expanded dynamic items.
Parameters
$menu_name: The menu name to use as base for the tree.
1 call to _admin_menu_tree()
- admin_menu_output in ./
admin_menu.module - Build the administration menu output.
File
- ./
admin_menu.inc, line 14 - Menu builder functions for Administration menu.
Code
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();
foreach ($expand_map as $path => $data) {
// Convert named placeholders to anonymous placeholders, since the menu
// system stores paths using anonymous placeholders.
$replacements = array_fill_keys(array_keys($data['arguments'][0]), '%');
$data['parent'] = strtr($data['parent'], $replacements);
$new_map[strtr($path, $replacements)] = $data;
}
$expand_map = $new_map;
unset($new_map);
// Retrieve dynamic menu link tree for the expansion mappings.
// @todo Skip entire processing if initial $expand_map is empty and directly
// return $tree?
if (!empty($expand_map)) {
$tree_dynamic = admin_menu_tree_dynamic($expand_map);
}
else {
$tree_dynamic = array();
}
// Merge local tasks with static menu tree.
$tree = menu_tree_all_data($menu_name);
admin_menu_merge_tree($tree, $tree_dynamic, array());
return $tree;
}