You are here

function admin_menu_build in Administration menu 5.2

Same name and namespace in other branches
  1. 5.3 admin_menu.inc \admin_menu_build()

Build the administration menu tree.

This is only called if the menu has been modified, i.e. the menu cache has been cleared.

Parameters

int $mid_admin: The menu item id to use for the administration menu.

1 call to admin_menu_build()
admin_menu_get_menu in ./admin_menu.module
Return Administration Menu from cache or rebuild it.

File

./admin_menu.inc, line 17
Cached builder functions for Drupal Administration Menu.

Code

function admin_menu_build($mid_admin) {
  global $_menu;
  $_admin_menu = array();

  // Temporary access permission fix for root menu items until #126621 is
  // committed to Drupal core.
  foreach ($_menu['items'][$mid_admin]['children'] as $key => $parent) {
    if ($_menu['items'][$parent]['access'] != FALSE || !isset($_menu['items'][$parent]['children'])) {
      continue;
    }
    $is_accessible = FALSE;
    foreach ($_menu['items'][$parent]['children'] as $key => $child) {
      if ($_menu['items'][$child]['access'] == TRUE) {
        $is_accessible = TRUE;
      }
    }
    if ($is_accessible) {
      $_menu['items'][$parent]['access'] = TRUE;
    }
  }

  // Copy admin menu items into a new menu tree.
  $_admin_menu['index'] = $_menu['path index'];
  $_admin_menu[$mid_admin] = $_menu['items'][$mid_admin];
  admin_menu_item_url($_admin_menu, $mid_admin);
  _admin_menu_get_children($_admin_menu, $_admin_menu[$mid_admin]);

  // Adjust some menu items for better user experience.
  admin_menu_adjust_items($_admin_menu);

  // Allow other modules to integrate with admin_menu.
  foreach (module_implements('admin_menu') as $module) {
    $function = $module . '_admin_menu';
    $function($_admin_menu, TRUE);
  }
  return $_admin_menu;
}