Tabs broken in custom theming

gordon - June 12, 2009 - 05:33
Project:Tabs panel style
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

Basically the tabs look really terrible and and don't render right at all.

I found that the difference is that the links have a ... where as the tabs in themes don't have this.

doing the following in my template.php

<?php
/**
* Return rendered tabset.
*
* @themable
*/
function solar_pay_tabset($element) {
 
$output = '<div id="tabs-'. $element['#tabset_name'] .'"'. drupal_attributes($element['#attributes']) .'>';
 
$output .= '<ul>';
  foreach (
element_children($element) as $key) {
    if (
$element[$key]['#type'] && $element[$key]['#type'] == 'tabpage') {
     
$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;
}
?>

It would be nice if this would support this in the Zen theme,

#1

dereine - June 12, 2009 - 12:49

so the only difference is that you create a span around the title link?

#2

gordon - August 2, 2009 - 23:40

Basically. Here is updated version which has the the classes 'tabs primary clear-block' add the the ul which fixed up the line under all the tabs.

I have added this to the template.php but I am sure there is a better solution.

<?php
/**
* Return rendered tabset.
*
* @themable
*/
function theme_name_tabset($element) {
 
$output = '<div id="tabs-'. $element['#tabset_name'] .'"'. drupal_attributes($element['#attributes']) .'>';
 
$output .= '<ul class="tabs primary clear-block">';
  foreach (
element_children($element) as $key) {
    if (
$element[$key]['#type'] && $element[$key]['#type'] == 'tabpage') {
     
$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;
}
?>

#3

dereine - June 13, 2009 - 07:36

what happens if you remove your custom theming, does the tabs work then?

i suggest you to change your css so you it works without the span.

#4

dereine - June 13, 2009 - 07:37
Title:Tabs broken in Zen theme» Tabs broken in custom theming

Changed title

#5

NancyDru - June 23, 2009 - 23:34

+1 - I'm seeing this too, but in 5.x-1.5 (also Zen Classic).

#6

cbarilla - July 31, 2009 - 16:08

I have the same problem in a zen subtheme based on classic. As mentioned the problem is that the theme needs a tag around the link text in order to style correctly. I have manually added the tag with developer tools for firefox and it works perfectly. I am just learning drupal so could anyone suggest a way to get the tag added to the generated output.

I am hesitant to make any kind of changes in template.php that may mess with other menus already cusotmized on the page. This would seem to be a matter of just changing some output in the panels_tabs.js file, but I am hesitant to play around in there.

Thanks

slamMan

 
 

Drupal is a registered trademark of Dries Buytaert.