function 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.

2 calls to toolbar_get_menu_tree()
toolbar_get_rendered_subtrees in drupal/core/modules/toolbar/toolbar.module
Returns the rendered subtree of each top-level toolbar link.
toolbar_toolbar in drupal/core/modules/toolbar/toolbar.module
Implements hook_toolbar().

File

drupal/core/modules/toolbar/toolbar.module, line 476
Administration toolbar for quick access to top level administration items.

Code

function toolbar_get_menu_tree() {
  $tree = array();
  $query = Drupal::entityQuery('menu_link')
    ->condition('menu_name', 'admin')
    ->condition('module', 'system')
    ->condition('link_path', 'admin');
  $result = $query
    ->execute();
  if (!empty($result)) {
    $admin_link = menu_link_load(reset($result));
    $tree = menu_build_tree('admin', array(
      'expanded' => array(
        $admin_link['mlid'],
      ),
      'min_depth' => $admin_link['depth'] + 1,
      'max_depth' => $admin_link['depth'] + 1,
    ));
  }
  return $tree;
}