I'm sorry to write that the "view" and "edit" buttons are still displayed and the javascript tabs are not...

Comments

ken hawkins’s picture

This is probably due to your theme overriding the tabs already; from the readme:

NOTE: If a theme already overrides the tabs (such as Drupal's stock admin theme, Seven) then JavaScript Tabs will do its best to detect a conflict and not to appear on that theme. This is because the theme's code will likely be designed to modify Drupal's default tab array, and if Javascript Tabs has already modified it then this could otherwise cause the theme to crash.

Would probably be helpful to others if this note were added to the module page, as well as a known-compatible theme were listed -- so that users unsure if there is a problem could try the theme.

webmestre’s picture

The admin used theme is SEVEN.
It's a pity not to use your module on Seven because I guess it could be one of the most popular admin themes...

Sunlight Studios’s picture

Category: support » feature

@Ken Hawkins: thanks for the suggestion, that note is now added to the module page.

The module takes its menu items directly from Drupal's tab arrays, so if a theme has modified their structure, there is no way for the module to guess where to find them.

@webmestre: you're right, Seven is popular & you've given me an idea... The only way to integrate JavaScript Tabs into a theme that already modifies the tabs would be to write it bespoke. Perhaps I could hard-code support for certain themes in, or even use a sub-module plugin type system.... I'll have a think on it.

Setting this to "feature request" as the module is actually behaving as expected.

Sunlight Studios’s picture

Title: Impossible to display the tabs » Support themes which already modify tabs

*also changing the title, should have done that in my last post, oops*

ken hawkins’s picture

@sunlight

I like the sound of the module being able to adapt to non-standard themes. You might also consider expanding the documentation so theme developers and site builders can adapt to their code to this module.

A first crack:

JavaScript Tabs uses the standard $variables['tabs'] element to render tabs. If you do not see widget, it is probable that your theme is using a different variable on its page.tpl.php template file

For example: In the Seven admin theme you would need to change this in the page.tpl.php:

    <?php print render($primary_local_tasks); ?>

into

    <?php print $variables['tabs']; ?>

If you wish to intlegently check for the presence of JavaScript Tabs, make use of these two checks:

    $themes = list_themes();
    $theme_visibility = variable_get('javascript_tabs_theme_visibility', array());

    if (in_array($theme, $theme_visibility)) { 
      print $variables['tabs'];
    } else {
      print render($primary_local_tasks);
    }
deanflory’s picture

Here is the header code for AdaptiveTheme custom subtheme:

page--full-width-wrappers.tpl.php
page.tpl.php

<?php if ($title || $primary_local_tasks || $secondary_local_tasks || $action_links = render($action_links)): ?>
              <header<?php print $content_header_attributes; ?>>

                <?php if ($title): ?>
                  <h1 id="page-title"><?php print $title; ?></h1>
                <?php endif; ?>

                <?php if ($primary_local_tasks || $secondary_local_tasks || $action_links): ?>
                  <div id="tasks">

                    <?php if ($primary_local_tasks): ?>
                      <ul class="tabs primary clearfix"><?php print render($primary_local_tasks); ?></ul>
                    <?php endif; ?>

                    <?php if ($secondary_local_tasks): ?>
                      <ul class="tabs secondary clearfix"><?php print render($secondary_local_tasks); ?></ul>
                    <?php endif; ?>

                    <?php if ($action_links = render($action_links)): ?>
                      <ul class="action-links clearfix"><?php print $action_links; ?></ul>
                    <?php endif; ?>

                  </div>
                <?php endif; ?>

              </header>
            <?php endif; ?>

When I changed out this bit:

<?php if ($primary_local_tasks): ?>
                      <ul class="tabs primary clearfix"><?php print render($primary_local_tasks); ?></ul>
                    <?php endif; ?>

With this, it worked perfectly! Thanks for the tip!

<?php if ($primary_local_tasks): ?>
                      <?php print $variables['tabs']; ?>
                    <?php endif; ?>

So, what about secondary tabs? How do I get those to work as submenus in Javascript Tabs? I haven't test yet, but I'm guessing since they were not covered in my change above, they therefore are not included.

deanflory’s picture

FYI, I also had to change the z-index to something higher to make sure the cog button/trigger and the menu were above page content.