You are here

protected function BootstrapQuickTabs::buildTabLinks in Bootstrap Quick Tabs 7

Build the actual tab links, with appropriate href, title and attributes.

Parameters

int $active_tab: The index of the active tab.

Return value

array Tab array.

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

File

./BootstrapQuickTabs.inc, line 127
Extends Quicktabs module's core functions.

Class

BootstrapQuickTabs
Renders the content using the Bootstrap Tabs widget.

Code

protected function buildTabLinks($active_tab) {
  $tabs = array();
  $qt_name = $this->quickset
    ->getName();
  $count = 1;
  foreach ($this->quickset
    ->getContents() as $i => $tab) {
    if (!empty($tab)) {
      $attributes = array(
        'href' => '#quicktabs-' . $qt_name . $count,
        'data-toggle' => 'tab',
        'class' => drupal_html_class($tab
          ->getTitle()),
      );
      $markup = '<a ' . drupal_attributes($attributes) . '>' . check_plain($this->quickset
        ->translateString($tab
        ->getTitle(), 'tab', $i)) . '</a>';
      $tablink = array(
        '#markup' => $markup,
      );
      $tabs[$i] = $tablink;
      $count++;
    }
  }
  return $tabs;
}