Same name in other branches
  1. 8.x-1.x src/Plugin/QuickRender/QuickUiTabs.php \Drupal\quicktabs\Plugin\QuickRender\QuickUiTabs::build_tablinks()

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

Parameters

$active_tab The index of the active tab.:

1 call to QuickUiTabs::build_tablinks()
QuickUiTabs::render in plugins/QuickUiTabs.inc
The only method that renderer plugins must implement.

File

plugins/QuickUiTabs.inc, line 58

Class

QuickUiTabs
Renders the content using the jQuery UI Tabs widget.

Code

protected function build_tablinks($active_tab) {
    $tabs = array();
    $qt_name = $this->quickset
        ->getName();
    foreach ($this->quickset
        ->getContents() as $i => $tab) {
        if (!empty($tab)) {
            // If we use l() here or a render array of type 'link', the '#' symbol will
            // be escaped. Sad panda is sad.
            $href = '#qt-' . $qt_name . '-ui-tabs' . ($i + 1);
            $quickset = $this->quickset;
            $attributes = array();
            $attributes['class'][] = drupal_html_class($tab->getTitle());
            drupal_alter('quicktabs_tablinks_attributes', $attributes, $quickset, $i);
            $attributes['href'] = $href;
            $tablink = array(
                '#markup' => '<a ' . drupal_attributes($attributes) . '>' . check_plain($this->quickset
                    ->translateString($tab->getTitle(), 'tab', $i)) . '</a>',
            );
            $tabs[$i] = $tablink;
        }
    }
    return $tabs;
}