Themeing per tabset
alanburke - October 20, 2008 - 13:44
| Project: | jQuery UI Tabs |
| Version: | 6.x-1.0 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
The default theme function
function theme_tabset($element)
seems to allow themeing only for ALL tabsets.
It would be great is themeing could be at tabset level.
For example, on some tabs, I prefer the tabs at the bottom.
Regards
Alan

#1
yup,.. great idea,.. please help us
#2
I've been trying to find a way to do this for 2 days now, grumble grumble
#3
Ok, It CAN be done. But it's not trivial.
function theme_tabset($element)will do the job.
Basically, you can do a switch based on the $element[#name],
and the provide different theme code depending on the name.
No code to hand on this machine...
Alan
#4
Try this out (Drupal 5 code):
<?phpfunction mytheme_tabset($element) {
$tabs = '';
foreach (element_children($element) as $key) {
if ($element[$key]['#type'] && $element[$key]['#type'] == 'tabpage') {
// Call whichever template you want at this point
$tabs .= _phptemplate_callback('mytab', array('key' => $key, 'element' => $element));
}
}
return _phptemplate_callback('mytabset', array('tabs' => $tabs, 'children' => $element['#children'], 'tabset_name' => $element['#tabset_name']));
}
?>
// mytab.tpl.php<li <?php echo drupal_attributes($element[$key]['#attributes']); ?>>
<a href="#tabs-<?php echo $element['#tabset_name'] .'-'. $element[$key]['#index'];?>">
<span class="tab"><?php echo $element[$key]['#title']; ?></span>
</a>
</li>
// mytabset.tpl.php<div id="tabs-<?php echo $tabset_name.'"'. drupal_attributes($element['#attributes']); ?>>
<ul class="anchors">
<?php echo $tabs; ?>
</ul>
<?php echo $children; ?>
</div>