function admin_menu_get_menu in Administration menu 5.3
Same name and namespace in other branches
- 5 admin_menu.inc \admin_menu_get_menu()
- 5.2 admin_menu.module \admin_menu_get_menu()
Return administration menu from cache or rebuild it.
Return value
An array containing a complete menu structure of all cached administration menu items.
4 calls to admin_menu_get_menu()
- admin_menu_output in ./
admin_menu.module - Build the administration menu output.
- theme_admin_menu_item in ./
admin_menu.module - High-performance implementation of theme_menu_item().
- theme_admin_menu_tree in ./
admin_menu.module - Return a rendered menu tree.
- _admin_menu_sort in ./
admin_menu.module - Comparator routine for use in sorting menu items.
File
- ./
admin_menu.module, line 373 - Render an administrative menu as a dropdown menu at the top of the window.
Code
function &admin_menu_get_menu() {
static $_admin_menu;
if (isset($_admin_menu)) {
return $_admin_menu;
}
global $user, $locale;
$cid = $user->uid . ':' . $locale . ':admin_menu';
$cache = cache_get($cid, 'cache_menu');
// Check if cache is an array needed to distinguish between v5.x-1.2 and later
// versions.
if ($cache && substr($cache->data, 0, 1) == 'a') {
$_admin_menu = unserialize($cache->data);
}
else {
require_once drupal_get_path('module', 'admin_menu') . '/admin_menu.inc';
// Ensure all modules are loaded when we need to rebuild.
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
module_list(TRUE, FALSE, FALSE);
menu_get_menu();
admin_menu_build($_admin_menu);
cache_set($cid, 'cache_menu', serialize($_admin_menu), time() + 60 * 60 * 24);
}
return $_admin_menu;
}