You are here

function navbar_get_menu_tree in Navbar 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.

2 calls to navbar_get_menu_tree()
navbar_get_rendered_subtrees in ./navbar.module
Returns the rendered subtree of each top-level navbar link.
navbar_navbar in ./navbar.navbar.inc
Implements hook_navbar().

File

./navbar.module, line 514
Administration navbar for quick access to top level administration items.

Code

function navbar_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) {

    // Only return top 3 menu levels.
    $tree = menu_build_tree('management', array(
      'min_depth' => $admin_link['depth'] + 1,
      'max_depth' => 5,
    ));
  }
  return $tree;
}