You are here

function theme_bootstrap_tabs in Bootstrap Quick Tabs 7

Theme function to output content for Bootstrap style tabs.

1 theme call to theme_bootstrap_tabs()
BootstrapQuickTabs::render in ./BootstrapQuickTabs.inc
Build render array.

File

./bootstrap_quicktabs.module, line 88
Provides Bootstrap's tab styles to the Quicktabs module. Adapted from the re_quicktabs_foundation module.

Code

function theme_bootstrap_tabs($variables) {

  // Prepare various information we need:
  //
  // Set aside the 'element' from the array for convenience:
  $element = $variables['element'];

  // Figure out the output pattern--we need to reverse the order of tabs and
  // panes if this is the 'below' kind of tabs:
  $output_pattern = $element['tabs']['#options']['position'] != 'below' ? '<div%1$s>%2$s%3$s</div>' : '<div%1$s>%3$s%2$s</div>';

  // Prepare the tabs:
  $tabs = drupal_render($element['tabs']);

  // Prepare the panes:
  $panes = '<div class="tab-content">';
  foreach ($element['panes'] as $pane) {
    $panes .= drupal_render($pane);
  }
  $panes .= '</div>';

  // Build and return the output:
  return sprintf($output_pattern, drupal_attributes($element['#options']['attributes']), $tabs, $panes);
}