Allow Zen theme to render tabs properly

Amitaibu - June 15, 2008 - 16:21
Project:Javascript Tools
Version:6.x-1.x-dev
Component:Tabs
Category:feature request
Priority:normal
Assigned:Unassigned
Status:reviewed & tested by the community
Description

I had a problem using Zen theme. I'm not sure if this solution is the correct one.

I've created tabs using panels_tabs, but in the Zen theme the tabs were not rendered properly. (snap1).
Patch solves this by adding <span class="tab"> (snap2).

AttachmentSize
Snap1.png23.69 KB

#1

nedjo - June 19, 2008 - 18:32

I only see one snap and don't understand what the issue or the suggested fix are.

#2

Amitaibu - June 19, 2008 - 18:37

Ahh! the upload problems of drupal...

Here's the patch again. When applied and using the Zen theme, the tabs will appear correctly (not like snap1).

AttachmentSize
jstools_add_span_to_tabs_1.patch 827 bytes

#3

Amitaibu - June 19, 2008 - 18:37
Status:active» needs review

#4

AntoineSolutions - July 15, 2008 - 22:15
Status:needs review» reviewed & tested by the community

I have tested this patch with both Zen and Garland themes and have not found any issues.

Cheers,

Jon Antoine
www.antoinsolutions.com

#5

John Money - August 15, 2008 - 17:18

+1 cheers on patch, but given its a theme function, shouldn't the patch be applied to zen (e.g. zen_tabset($element){}).

#6

Amitaibu - August 15, 2008 - 21:08

@gestaltware, I didn't understand - which function do you refer in Zen?

#7

DesignWork - August 22, 2008 - 07:28

Hi All,

you dont need to provide a patch for this. As you are patching a theme function just copy the function to your template.php, rename it with mytheme_function and change all the output you want.

like this:

/**
* Return rendered tabset.
* DG 22.08.2008 we override the tabs from the jstools tab module, because there are not rendering the tabs the way we want.
* First we override the tabset only.
* @themable
*/
function zen_tabset($element) {
  $output = '<div id="tabs-'. $element['#tabset_name'] .'"'. drupal_attributes($element['#attributes']) .'>';
  $output .= '<ul class="anchors">';
  foreach (element_children($element) as $key) {
    if ($element[$key]['#type'] && $element[$key]['#type'] == 'tabpage') {

     // old code $output .= '<li'. drupal_attributes($element[$key]['#attributes']) .'><a href="#tabs-'. $element['#tabset_name'] .'-'. $element[$key]['#index'] .'">'. $element[$key]['#title'] .'</a></li>';
   // new code;
      $output .= '<li'. drupal_attributes($element[$key]['#attributes']) .'><a href="#tabs-'. $element['#tabset_name'] .'-'. $element[$key]['#index'] .'"><span class="tab">'. $element[$key]['#title'] .'</span></a></li>';
}
  }
  $output .= '</ul>';
  $output .= $element['#children'];
  $output .= '</div>';
  return $output;
}

Cheers from Cologne

Dirk

#8

Amitaibu - August 22, 2008 - 08:26

@Dirk,
Indeed this is a theme function, however, since Zen is a popular starting kit, instead of people looking what needs to be changed, Tabs can add this span - as it has no negative effect in other themes.

#9

Amitaibu - March 24, 2009 - 14:39
Version:5.x-1.1» 6.x-1.x-dev

Re-rolled to D6. The zen in me is much happier :)

AttachmentSize
tabs_compatible_with_zen_theme_9.patch 1.01 KB

#10

SocialNicheGuru - March 27, 2009 - 19:14

patch works and should be committed to D6

 
 

Drupal is a registered trademark of Dries Buytaert.