summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2010-07-02 02:22:26 +0000
committerDries Buytaert <dries@buytaert.net>2010-07-02 02:22:26 +0000
commit5b55646e2a5266c084d5e4af77ecb0d63d648d50 (patch)
treebf20703d33c9dea0d03396b3f58012c30f3cfa2e /modules
parente4be0eb7e849ea9d132a2bcf1a4ee5087db8bf75 (diff)
downloadbrdo-5b55646e2a5266c084d5e4af77ecb0d63d648d50.tar.gz
brdo-5b55646e2a5266c084d5e4af77ecb0d63d648d50.tar.bz2
- Patch #620618 by sun, Damien Tournoud, JohnAlbin, makara: optimize menu tree building and use it for toolbar.
Diffstat (limited to 'modules')
-rw-r--r--modules/toolbar/toolbar.module13
1 files changed, 6 insertions, 7 deletions
diff --git a/modules/toolbar/toolbar.module b/modules/toolbar/toolbar.module
index 348c0a29e..93f798288 100644
--- a/modules/toolbar/toolbar.module
+++ b/modules/toolbar/toolbar.module
@@ -279,14 +279,13 @@ function toolbar_view() {
*/
function toolbar_get_menu_tree() {
$tree = array();
- $admin_link = db_query("SELECT * FROM {menu_links} WHERE menu_name = 'management' AND module = 'system' AND link_path = 'admin'")->fetchAssoc();
+ $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) {
- // @todo Use a function like book_menu_subtree_data().
- $tree = menu_tree_all_data('management', $admin_link, $admin_link['depth'] + 1);
- // The tree will be a sub-tree with the admin link as a single root item.
- // @todo It is wrong to assume it's the last.
- $admin_link = array_pop($tree);
- $tree = $admin_link['below'] ? $admin_link['below'] : array();
+ $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;