diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-08-14 15:30:59 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-08-14 15:30:59 +0000 |
commit | bc2a814c6d3aaa47625cfc8cd9e3c3e83e153639 (patch) | |
tree | 58dc2ee0a64be05430eb71430276279052583232 /modules | |
parent | 40052b63f2ba16b62c3e2061b7ca8dd5171b2c1d (diff) | |
download | brdo-bc2a814c6d3aaa47625cfc8cd9e3c3e83e153639.tar.gz brdo-bc2a814c6d3aaa47625cfc8cd9e3c3e83e153639.tar.bz2 |
#519046 by catch, pwolanin: Fix how toolbar_get_menu_tree() determines menu to remove unneeded calls to _menu_check_access().
Diffstat (limited to 'modules')
-rw-r--r-- | modules/toolbar/toolbar.module | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/modules/toolbar/toolbar.module b/modules/toolbar/toolbar.module index 13c5f2218..0ca9cf714 100644 --- a/modules/toolbar/toolbar.module +++ b/modules/toolbar/toolbar.module @@ -111,19 +111,18 @@ function toolbar_build() { * Get only the top level items below the 'admin' path. */ function toolbar_get_menu_tree() { - $tree = menu_tree_all_data('management'); - foreach ($tree as $item) { - if ($item['link']['link_path'] == 'admin' && !empty($item['below'])) { - // Only take items right below the 'admin' path. All other management - // items are discarded. - $tree = $item['below']; - break; + $tree = array(); + $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(); + foreach ($tree as $key => $item) { + // Get rid of subitems to have a leaner data structure. + unset($tree[$key]['below']); } } - foreach ($tree as $key => $item) { - // Get rid of subitems to have a leaner data structure. - unset($tree[$key]['below']); - } return $tree; } |