Same name and namespace in other branches
  1. 7.x-3.x plugins/QuickUiTabs.inc \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 src/Plugin/QuickRender/QuickUiTabs.php

File

src/Plugin/QuickRender/QuickUiTabs.php, line 72

Class

QuickUiTabs
Renders the content using the jQuery UI Tabs widget.

Namespace

Drupal\quicktabs\Plugin\QuickRender

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);
            $tablink = array(
                '#markup' => '<a href="' . $href . '">' . SafeMarkup::checkPlain($this->quickset
                    ->translateString($tab->getTitle(), 'tab', $i)) . '</a>',
            );
            $tabs[$i] = $tablink;
        }
    }
    return $tabs;
}