diff --git includes/common.inc includes/common.inc index d5a394d..cb7c681 100644 --- includes/common.inc +++ includes/common.inc @@ -5541,7 +5541,7 @@ function drupal_common_theme() { 'render element' => 'element', ), 'menu_local_tasks' => array( - 'variables' => array(), + 'variables' => array('primary' => array(), 'secondary' => array()), ), // from form.inc 'select' => array( diff --git includes/menu.inc includes/menu.inc index 6b6ed29..26acb2d 100644 --- includes/menu.inc +++ includes/menu.inc @@ -1985,22 +1985,33 @@ function menu_tab_root_path() { } /** - * Returns renderable local tasks. + * Returns a renderable element of the primary and secondary tabs. + */ +function menu_local_tabs() { + return array( + '#theme' => 'menu_local_tasks', + '#primary' => menu_primary_local_tasks(), + '#secondary' => menu_secondary_local_tasks(), + ); +} + +/** + * Formats the primary and secondary local tasks. * * @ingroup themeable */ -function theme_menu_local_tasks() { - $output = array(); +function theme_menu_local_tasks(&$variables) { + $output = ''; - if ($primary = menu_primary_local_tasks()) { - $primary['#prefix'] = ''; - $output[] = $primary; + if (!empty($variables['primary'])) { + $output .= ''; } - if ($secondary = menu_secondary_local_tasks()) { - $secondary['#prefix'] = ''; - $output[] = $secondary; + if (!empty($variables['secondary'])) { + $output .= ''; } return $output; diff --git includes/theme.inc includes/theme.inc index e481e38..0f19552 100644 --- includes/theme.inc +++ includes/theme.inc @@ -2357,7 +2357,7 @@ function template_preprocess_page(&$variables) { $variables['action_links'] = menu_local_actions(); $variables['site_name'] = (theme_get_setting('toggle_name') ? filter_xss_admin(variable_get('site_name', 'Drupal')) : ''); $variables['site_slogan'] = (theme_get_setting('toggle_slogan') ? filter_xss_admin(variable_get('site_slogan', '')) : ''); - $variables['tabs'] = theme('menu_local_tasks'); + $variables['tabs'] = menu_local_tabs(); $variables['title'] = drupal_get_title(); if ($node = menu_get_object()) { diff --git themes/garland/page.tpl.php themes/garland/page.tpl.php index 0eba988..2275a29 100644 --- themes/garland/page.tpl.php +++ themes/garland/page.tpl.php @@ -47,8 +47,8 @@ > - - + + diff --git themes/garland/template.php themes/garland/template.php index 64f1929..d1dd5aa 100644 --- themes/garland/template.php +++ themes/garland/template.php @@ -59,7 +59,12 @@ function garland_process_html(&$vars) { * Override or insert variables into the page template. */ function garland_preprocess_page(&$vars) { - $vars['tabs2'] = menu_secondary_local_tasks(); + // Move the secondary tabs to a new variable. + $vars['tabs2'] = array( + '#theme' => 'menu_local_tasks', + '#secondary' => $vars['tabs']['#secondary'], + ); + unset($vars['tabs']['#secondary']); if (isset($vars['main_menu'])) { $vars['primary_nav'] = theme('links__system_main_menu', array( 'links' => $vars['main_menu'], @@ -131,11 +136,3 @@ function garland_preprocess_region(&$vars) { $vars['classes_array'][] = 'clearfix'; } } - -/** - * Returns the rendered local tasks. The default implementation renders - * them as tabs. Overridden to split the secondary tasks. - */ -function garland_menu_local_tasks() { - return menu_primary_local_tasks(); -}