From 3d1058eb264f5269bfc268e94bb8de0c4aa5dc01 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Fri, 30 Oct 2009 21:43:41 +0000 Subject: - Patch #519046 by catch, pwolanin, sun: clean up toolbar menu code and added TODOs. --- modules/toolbar/toolbar.module | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'modules') diff --git a/modules/toolbar/toolbar.module b/modules/toolbar/toolbar.module index 9003daedc..4868e78e0 100644 --- a/modules/toolbar/toolbar.module +++ b/modules/toolbar/toolbar.module @@ -134,14 +134,12 @@ 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(); if ($admin_link) { - $tree = menu_tree_all_data('management', $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(); - foreach ($tree as $key => $item) { - // Get rid of subitems to have a leaner data structure. - unset($tree[$key]['below']); - } } return $tree; } -- cgit v1.2.3