admin_menu_links_menu

Versions
6 – 7
admin_menu_links_menu($tree)

Build the administration menu as renderable menu links.

See also

theme_admin_menu_links()

@see admin_menu_menu_alter()

Parameters

$tree A data structure representing the administration menu tree as returned from menu_tree_all_data().

Return value

The complete administration menu, suitable for theme_admin_menu_links().

▾ 2 functions call admin_menu_links_menu()

admin_menu_links_menu in contributions/admin_menu/admin_menu.inc
Build the administration menu as renderable menu links.
admin_menu_output in contributions/admin_menu/admin_menu.module
Build the administration menu output.

Code

contributions/admin_menu/admin_menu.inc, line 378

<?php
function admin_menu_links_menu($tree) {
  $links = array();
  foreach ($tree as $data) {
    // Skip invisible items.
    if (!$data['link']['access'] || $data['link']['type'] == MENU_CALLBACK) {
      continue;
    }
    // Hide 'Administer' and make child links appear on this level.
    // @todo Make this configurable.
    if ($data['link']['router_path'] == 'admin') {
      if ($data['below']) {
        $links = array_merge($links, admin_menu_links_menu($data['below']));
      }
      continue;
    }
    // Remove local tasks on 'admin'.
    if (in_array($data['link']['router_path'], array('admin/by-task', 'admin/by-module'))) {
      continue;
    }
    // Omit alias lookups.
    $data['link']['localized_options']['alias'] = TRUE;
    // Remove description to prevent mouseover tooltip clashes.
    unset($data['link']['localized_options']['attributes']['title']);

    $links[$data['link']['mlid']] = array(
      '#title' => $data['link']['title'],
      '#href' => $data['link']['href'],
      '#options' => $data['link']['localized_options'],
      '#weight' => $data['link']['weight'],
    );
    if ($data['below']) {
      $links[$data['link']['mlid']] += admin_menu_links_menu($data['below']);
    }
  }
  return $links;
}
?>

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.