function toolbar_get_menu_tree

7.x toolbar.module toolbar_get_menu_tree()

Gets only the top level items below the 'admin' path.

Return value

An array containing a menu tree of top level items below the 'admin' path.

1 call to toolbar_get_menu_tree()
toolbar_view in drupal-7.x/modules/toolbar/toolbar.module
Builds the admin menu as a structured array ready for drupal_render().

File

drupal-7.x/modules/toolbar/toolbar.module, line 284
Administration toolbar for quick access to top level administration items.

Code

function toolbar_get_menu_tree() {
  $tree = array();
  $admin_link = db_query('SELECT * FROM {menu_links} WHERE menu_name = :menu_name AND module = :module AND link_path = :path', array(':menu_name' => 'management', ':module' => 'system', ':path' => 'admin'))->fetchAssoc();
  if ($admin_link) {
    $tree = menu_build_tree('management', array(
      'expanded' => array($admin_link['mlid']),
      'min_depth' => $admin_link['depth'] + 1,
      'max_depth' => $admin_link['depth'] + 1,
    ));
  }

  return $tree;
}