function admin_menu_admin_menu_output_build

nittany7 admin_menu.module admin_menu_admin_menu_output_build(&$content)
cis7 admin_menu.module admin_menu_admin_menu_output_build(&$content)
mooc7 admin_menu.module admin_menu_admin_menu_output_build(&$content)

Implements hook_admin_menu_output_build().

File

modules/contrib/admin_menu/admin_menu.module, line 566
Render an administrative menu as a dropdown menu at the top of the window.

Code

function admin_menu_admin_menu_output_build(&$content) {
  if (!isset($content['menu'])) {
    return;
  }

  // Unassign weights for categories below Configuration.
  // An alphabetical order is more natural for a dropdown menu.
  if (isset($content['menu']['admin/config'])) {
    foreach (element_children($content['menu']['admin/config']) as $key) {
      $content['menu']['admin/config'][$key]['#weight_original'] = $content['menu']['admin/config'][$key]['#weight'];
      unset($content['menu']['admin/config'][$key]['#weight']);
    }
  }

  // Retrieve the "Add content" link tree.
  $link = db_query("SELECT * FROM {menu_links} WHERE router_path = 'node/add' AND module = 'system'")->fetchAssoc();
  $conditions = array();
  for ($i = 1; $i < MENU_MAX_DEPTH; $i++) {
    if (!empty($link["p$i"])) {
      $conditions["p$i"] = $link["p$i"];
    }
  }
  $tree = menu_build_tree($link['menu_name'], array(
    'conditions' => $conditions,
    'min_depth' => $link['depth'],
  ));
  $links = admin_menu_links_menu($tree);
  if (!empty($links)) {
    // If the user has access to the top-level "Content" category, insert the
    // "Add content" link tree there.
    if (isset($content['menu']['admin/content'])) {
      $content['menu']['admin/content'] += $links;
    }
    // Otherwise make insert "Add content" as top-level category.
    else {
      $key = key($links);
      $links[$key]['#weight'] = -100;
      $content['menu'] += $links;
    }
  }
}