Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello,
I work on the implementation of twitter bootstrap tab system (instead of jquery ui one) for the Panel tabs module.
Feel free to implement it. Personnaly, I put that code in includes/modules/panels_tabs.inc to follow the theme logic (and add an include_once in template.php).
Here is the code :
function twitter_bootstrap_panels_tabs_style_render_region($vars) {
$display = $vars['display'];
$region_id = $vars['region_id'];
$owner_id = $vars['owner_id'];
$panes = $vars['panes'];
$tab_id = 'tabs-' . $owner_id . '-' . $region_id;
$settings = array();
$settings['panelsTabs']['tabsID'][] = $tab_id;
// Get the pane titles.
$items = array();
$delta = 1;
foreach ($display->panels[$region_id] as $pane_id) {
// Make sure the pane exists.
if (!empty($panes[$pane_id])) {
$title = panels_tabs_pane_titles($display->did, $pane_id);
$title = $title ? $title : t('Tab @delta', array('@delta' => $delta));
// Set active class for first tab
if($delta == 1) {
$items[] = array(
'data' => '<a href="#'. $tab_id . '-' . $delta .'" data-toggle="tab">' . $title . '</a>',
'class' => array('active')
);
} else {
$items[] = array(
'data' => '<a href="#'. $tab_id . '-' . $delta .'" data-toggle="tab">' . $title . '</a>',
);
}
++$delta;
}
}
$element['tabs_title'] = array('#theme' => 'item_list', '#items' => $items, '#type' => 'ul', '#attributes' => array('class' => 'nav nav-tabs'));
$items = array();
$delta = 1;
foreach ($panes as $pane_id => $item) {
if($delta == 1) {
$class = 'tab-pane active';
} else {
$class = 'tab-pane';
}
$element['tabs_content'][$pane_id] = array(
'#prefix' => '<div class="'.$class.'" id="' . $tab_id . '-' . $delta . '">',
'#suffix' => '</div>',
'#markup' => $item,
);
++$delta;
}
$element['tabs_content']['#prefix'] = '<div class="tab-content">';
$element['tabs_content']['#suffix'] = '</div>';
return drupal_render($element);
}
Comment | File | Size | Author |
---|---|---|---|
#5 | panels.zip | 20.08 KB | zmove |
Comments
Comment #1
natted CreditAttribution: natted commentedThanks @zmove, I'll try test this tonight.
Comment #2
andregriffin CreditAttribution: andregriffin commentedComment #3
andregriffin CreditAttribution: andregriffin commentedComment #4
natted CreditAttribution: natted commentedComment #5
zmove CreditAttribution: zmove commentedWrong issue page. see here #1833622: Panels layouts
Comment #6
alibama CreditAttribution: alibama commenteddoes this fix the tabs not responding to the overridden titles? I can't for the life of me get tab 1, tab 2 .... to go away. have overrides on all the panel titles
fwiw i've added this module and edited the boostrap.info file and do not see the changes working.... thanks again for any thoughts
Comment #7
markhalliwellPlease submit a patch.
Comment #8
markhalliwellScripted response: This issue has been closed while cleaning up the issue queue. This has likely already been addressed in 7.x-3.x. If it has not, please create a new issue describing the exact issue with that version. The 7.x-2.x branch currently only receives security fixes.