You are here

function toolbar_get_menu_tree in Drupal 7

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 modules/toolbar/toolbar.module
Builds the admin menu as a structured array ready for drupal_render().

File

modules/toolbar/toolbar.module, line 287
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;
}