Commit 1a91990c authored by webchick's avatar webchick
Browse files

#599706 follow-up by JohnAlbin, sun: Regression: Restore consistency to...

#599706 follow-up by JohnAlbin, sun: Regression: Restore consistency to theme_menu_local_tasks() theme function
parent aa105223
......@@ -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(
......
......@@ -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'] = '<h2 class="element-invisible">' . t('Primary tabs') . '</h2><ul class="tabs primary">';
$primary['#suffix'] = '</ul>';
$output[] = $primary;
}
if ($secondary = menu_secondary_local_tasks()) {
$secondary['#prefix'] = '<h2 class="element-invisible">' . t('Secondary tabs') . '</h2><ul class="tabs secondary">';
$secondary['#suffix'] = '</ul>';
$output[] = $secondary;
if (!empty($variables['primary'])) {
$variables['primary']['#prefix'] = '<h2 class="element-invisible">' . t('Primary tabs') . '</h2>';
$variables['primary']['#prefix'] .= '<ul class="tabs primary">';
$variables['primary']['#suffix'] = '</ul>';
$output .= drupal_render($variables['primary']);
}
if (!empty($variables['secondary'])) {
$variables['secondary']['#prefix'] = '<h2 class="element-invisible">' . t('Secondary tabs') . '</h2>';
$variables['secondary']['#prefix'] .= '<ul class="tabs secondary">';
$variables['secondary']['#suffix'] = '</ul>';
$output .= drupal_render($variables['secondary']);
}
return $output;
......
......@@ -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;
......
......@@ -489,7 +489,7 @@ function template_process_overlay(&$variables) {
*/
function overlay_preprocess_page(&$variables) {
if (overlay_get_mode() == 'child') {
unset($variables['tabs'][0]);
unset($variables['tabs']['#primary']);
}
}
......
......@@ -47,8 +47,8 @@
<h1<?php print $tabs ? ' class="with-tabs"' : '' ?>><?php print $title ?></h1>
<?php endif; ?>
<?php print render($title_suffix); ?>
<?php if ($tabs): ?><h2 class="element-invisible"><?php print t('Primary tabs'); ?></h2><ul class="tabs primary"><?php print render($tabs) ?></ul></div><?php endif; ?>
<?php if ($tabs2): ?><h2 class="element-invisible"><?php print t('Secondary tabs'); ?></h2><ul class="tabs secondary"><?php print render($tabs2) ?></ul><?php endif; ?>
<?php if ($tabs): ?><?php print render($tabs); ?></div><?php endif; ?>
<?php print render($tabs2); ?>
<?php print $messages; ?>
<?php print render($page['help']); ?>
<?php if ($action_links): ?><ul class="action-links"><?php print render($action_links); ?></ul><?php endif; ?>
......
......@@ -59,7 +59,13 @@ 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 secondary tabs into a separate 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'],
......@@ -139,11 +145,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();
}
......@@ -8,17 +8,11 @@
<h1 class="page-title"><?php print $title; ?></h1>
<?php endif; ?>
<?php print render($title_suffix); ?>
<?php if ($primary_local_tasks): ?>
<h2 class="element-invisible"><?php print t('Primary tabs'); ?></h2>
<ul class="tabs primary"><?php print render($primary_local_tasks); ?></ul>
<?php endif; ?>
<?php print render($primary_local_tasks); ?>
</div>
<div id="page">
<?php if ($secondary_local_tasks): ?>
<h2 class="element-invisible"><?php print t('Secondary tabs'); ?></h2>
<ul class="tabs secondary"><?php print render($secondary_local_tasks); ?></ul>
<?php endif; ?>
<?php print render($secondary_local_tasks); ?>
<div id="content" class="clearfix">
<div class="element-invisible"><a id="main-content"></a></div>
......
......@@ -869,7 +869,6 @@ ol.task-list li.done {
background-color: #fff;
padding-top: 15px;
}
.overlay .primary,
.overlay #branding h1.page-title,
.overlay #left,
.overlay #footer {
......
......@@ -27,8 +27,12 @@ function seven_preprocess_html(&$vars) {
* Override or insert variables into the page template.
*/
function seven_preprocess_page(&$vars) {
$vars['primary_local_tasks'] = menu_primary_local_tasks();
$vars['secondary_local_tasks'] = menu_secondary_local_tasks();
$vars['primary_local_tasks'] = $vars['tabs'];
unset($vars['primary_local_tasks']['#secondary']);
$vars['secondary_local_tasks'] = array(
'#theme' => 'menu_local_tasks',
'#secondary' => $vars['tabs']['#secondary'],
);
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment