summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--includes/common.inc2
-rw-r--r--includes/menu.inc37
-rw-r--r--includes/theme.inc2
-rw-r--r--modules/overlay/overlay.module2
-rw-r--r--themes/garland/page.tpl.php4
-rw-r--r--themes/garland/template.php16
-rw-r--r--themes/seven/page.tpl.php10
-rw-r--r--themes/seven/style.css1
-rw-r--r--themes/seven/template.php8
9 files changed, 45 insertions, 37 deletions
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'] = '<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;
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;
diff --git a/modules/overlay/overlay.module b/modules/overlay/overlay.module
index aa78f2123..e278a0174 100644
--- a/modules/overlay/overlay.module
+++ b/modules/overlay/overlay.module
@@ -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']);
}
}
diff --git a/themes/garland/page.tpl.php b/themes/garland/page.tpl.php
index 6dc50c2d5..448d21601 100644
--- a/themes/garland/page.tpl.php
+++ b/themes/garland/page.tpl.php
@@ -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; ?>
diff --git a/themes/garland/template.php b/themes/garland/template.php
index 6c3fc446f..8021d7cdd 100644
--- a/themes/garland/template.php
+++ b/themes/garland/template.php
@@ -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();
-}
diff --git a/themes/seven/page.tpl.php b/themes/seven/page.tpl.php
index 72fd6d02a..c8ff98abf 100644
--- a/themes/seven/page.tpl.php
+++ b/themes/seven/page.tpl.php
@@ -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>
diff --git a/themes/seven/style.css b/themes/seven/style.css
index deca79bd9..df7f3de36 100644
--- a/themes/seven/style.css
+++ b/themes/seven/style.css
@@ -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 {
diff --git a/themes/seven/template.php b/themes/seven/template.php
index 78d41f168..0b0afc192 100644
--- a/themes/seven/template.php
+++ b/themes/seven/template.php
@@ -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'],
+ );
}
/**