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);
}
CommentFileSizeAuthor
#5 panels.zip20.08 KBzmove
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

natted’s picture

Thanks @zmove, I'll try test this tonight.

andregriffin’s picture

Project: Twitter's Bootstrap » Bootstrap Framework
andregriffin’s picture

Project: Bootstrap Framework » Twitter's Bootstrap
natted’s picture

Project: Twitter's Bootstrap » Bootstrap
zmove’s picture

FileSize
20.08 KB

Wrong issue page. see here #1833622: Panels layouts

alibama’s picture

does 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

markhalliwell’s picture

Status: Needs review » Active
markhalliwell’s picture

Status: Active » Closed (won't fix)

Scripted 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.