From 1a91990cae84f045b774e0eb308334dea1e97b28 Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Sat, 20 Nov 2010 04:03:51 +0000 Subject: #599706 follow-up by JohnAlbin, sun: Regression: Restore consistency to theme_menu_local_tasks() theme function --- includes/common.inc | 2 +- includes/menu.inc | 37 +++++++++++++++++++++++++------------ includes/theme.inc | 2 +- 3 files changed, 27 insertions(+), 14 deletions(-) (limited to 'includes') diff --git a/includes/common.inc b/includes/common.inc index 801967f99..7a9dff388 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -6362,7 +6362,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 a/includes/menu.inc b/includes/menu.inc index 9d3fef979..b72e3ff90 100644 --- a/includes/menu.inc +++ b/includes/menu.inc @@ -2132,22 +2132,35 @@ function menu_tab_root_path() { } /** - * Returns renderable local tasks. + * Returns a renderable element for 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(), + ); +} + +/** + * Returns HTML for 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'] = '

' . t('Primary tabs') . '

'; - $output[] = $primary; - } - if ($secondary = menu_secondary_local_tasks()) { - $secondary['#prefix'] = '

' . t('Secondary tabs') . '

'; - $output[] = $secondary; + if (!empty($variables['primary'])) { + $variables['primary']['#prefix'] = '

' . t('Primary tabs') . '

'; + $variables['primary']['#prefix'] .= ''; + $output .= drupal_render($variables['primary']); + } + if (!empty($variables['secondary'])) { + $variables['secondary']['#prefix'] = '

' . t('Secondary tabs') . '

'; + $variables['secondary']['#prefix'] .= ''; + $output .= drupal_render($variables['secondary']); } return $output; diff --git a/includes/theme.inc b/includes/theme.inc index fcb9ebf1d..887ed23ce 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -2258,7 +2258,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(); if ($node = menu_get_object()) { $variables['node'] = $node; -- cgit v1.2.3