Index: admin_menu.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/admin_menu/admin_menu.module,v retrieving revision 1.43.2.17.2.19 diff -u -p -r1.43.2.17.2.19 admin_menu.module --- admin_menu.module 18 Jul 2009 22:10:11 -0000 1.43.2.17.2.19 +++ admin_menu.module 18 Jul 2009 22:55:26 -0000 @@ -394,8 +394,8 @@ function admin_menu_output() { // not all) multi-domain setups (e.g. language-based sub-domains). $class_site = 'admin-menu-site' . drupal_strtolower(preg_replace('/[^a-zA-Z0-9-]/', '-', $GLOBALS['cookie_domain'])); // @todo Always output container to harden JS-less support. - $content['#prefix'] = '
'; - $content['#suffix'] = '
'; + $content['#prefix'] = '
'; // Add menu additions. module_load_include('inc', 'admin_menu'); @@ -445,8 +445,10 @@ function admin_menu_output() { * - '#options': Optional alternative text for the link, passed to l(). * * The array key of each child element itself is passed as path for l(). + * @param $depth + * Current recursion level; internal use only. */ -function theme_admin_menu_links(&$elements) { +function theme_admin_menu_links(&$elements, $depth = 0) { $output = ''; foreach (element_children($elements, TRUE) as $path) { // Early-return nothing if user does not have access. @@ -458,7 +460,7 @@ function theme_admin_menu_links(&$elemen '#options' => array(), ); // Render children to determine whether this link is expandable. - $children = theme('admin_menu_links', $elements[$path]); + $children = theme('admin_menu_links', $elements[$path], $depth + 1); if (!empty($children)) { $elements[$path]['#attributes']['class'][] = 'expandable'; } @@ -482,7 +484,16 @@ function theme_admin_menu_links(&$elemen $output .= ''; } // @todo #attributes probably required for UL, but already used for LI. - return $output ? '' : ''; + // @todo Use $element['#theme'] + $element['#children'] here instead. + if ($output) { + if ($depth > 0) { + $output = "\n'; + } + else { + $output = $output; + } + } + return $output; } /** @@ -491,11 +502,13 @@ function theme_admin_menu_links(&$elemen * @param $tree * A data structure representing the tree as returned from * menu_tree_all_data(). + * @param $depth + * Current recursion level; internal use only. * * @return * The complete, rendered administration menu. */ -function admin_menu_tree_output($tree) { +function admin_menu_tree_output($tree, $depth = 0) { $output = ''; foreach ($tree as $data) { @@ -506,13 +519,22 @@ function admin_menu_tree_output($tree) { $link = admin_menu_item_link($data['link']); if ($data['below']) { - $output .= theme_admin_menu_item($link, $data['link']['has_children'], admin_menu_tree_output($data['below']), $data['link']['in_active_trail']); + $output .= theme_admin_menu_item($link, $data['link']['has_children'], admin_menu_tree_output($data['below'], $depth + 1), $data['link']['in_active_trail']); } else { $output .= theme_admin_menu_item($link, $data['link']['has_children'], '', $data['link']['in_active_trail']); } } - return $output ? "\n' : ''; + // @todo Use $element['#theme'] + $element['#children'] here instead. + if ($output) { + if ($depth > 0) { + $output = "\n'; + } + else { + $output = $output; + } + } + return $output; } /**