diff --git modules/toolbar/toolbar.module modules/toolbar/toolbar.module index 0d7225b..37df34b 100644 --- modules/toolbar/toolbar.module +++ modules/toolbar/toolbar.module @@ -115,9 +115,12 @@ function toolbar_get_menu_tree() { $admin_link = db_query("SELECT * FROM {menu_links} WHERE menu_name = 'management' AND module = 'system' AND link_path = 'admin'")->fetchAssoc(); if ($admin_link) { $tree = menu_tree_all_data('management', $admin_link); - // The tree will be a sub-tree with the admin link as a single root item. - $admin_link = array_pop($tree); - $tree = $admin_link['below'] ? $admin_link['below'] : array(); + $mlid = $admin_link['mlid']; + // The tree will usually only be expanded below the admin link. + do { + $admin_link = array_pop($tree); + } while($admin_link && $admin_link['mlid'] != $mlid); + $tree = !empty($admin_link['below']) ? $admin_link['below'] : array(); foreach ($tree as $key => $item) { // Get rid of subitems to have a leaner data structure. unset($tree[$key]['below']);