You are here

function admin_menu_navigation_links in Admin 6

Generate a links array from a menu tree array.

3 calls to admin_menu_navigation_links()
admin_menu_tree_links in ./admin.module
Build a hierarchy of $links arrays suitable for theme_links() from a menu tree.
admin_navigation_primary in ./admin.module
Generate the 1st level of navigation links under 'admin'.
admin_navigation_secondary in ./admin.module
Generate the 2nd level of navigation links under 'admin/*'.

File

./admin.module, line 511

Code

function admin_menu_navigation_links($tree, $admin_only = FALSE) {
  $links = array();
  foreach ($tree as $item) {
    if (!$item['link']['hidden'] && (!$admin_only || !empty($item['link']['options']['admin']))) {
      $class = '';
      $id = str_replace('/', '-', $item['link']['href']);
      $l = $item['link']['localized_options'];
      $l['href'] = $item['link']['href'];
      $l['title'] = "<span class='icon'></span>" . $item['link']['title'];
      $l['attributes'] = array(
        'id' => 'admin-link-' . $id,
      );
      $l['html'] = TRUE;
      $class = ' path-' . $id;
      if (admin_in_active_trail($item['link']['href'])) {
        $class .= ' active-trail';
      }

      // Keyed with the unique mlid to generate classes in theme_links().
      $links['menu-' . $item['link']['mlid'] . $class] = $l;
    }
  }
  return $links;
}