Same name in other branches
- 7.x-3.x plugins/QuickQuicktabs.inc \QuickQuicktabs::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 QuickQuicktabs::build_tablinks()
- QuickQuicktabs::render in src/
Plugin/ QuickRender/ QuickQuicktabs.php
File
-
src/
Plugin/ QuickRender/ QuickQuicktabs.php, line 83
Class
- QuickQuicktabs
- Renders the content using the original Quicktabs mechanism of previous versions. Includes support for ajax rendered content.
Namespace
Drupal\quicktabs\Plugin\QuickRenderCode
protected function build_tablinks($active_tab) {
$quickset = $this->quickset;
$settings = $quickset->getSettings();
$tabs = array();
foreach ($quickset->getContents() as $i => $tab) {
if (!empty($tab)) {
$tablink = array(
'#type' => 'link',
'#title' => $quickset->translateString($tab->getTitle(), 'tab', $i),
'#href' => $_GET['q'],
'#options' => $this->construct_link_options($i),
);
if ($settings['ajax']) {
$tab_settings = $tab->getSettings();
$ajax_keys = $tab->getAjaxKeys();
$ajax_args = array();
foreach ($ajax_keys as $key) {
$ajax_args[] = $tab_settings[$key];
}
$ajax_path = $quickset->getAjaxPath($i, $tab->getType());
$ajax_href = $ajax_path . '/' . implode('/', $ajax_args);
$tablink['#ajax'] = array(
'progress' => array(
'message' => '',
'type' => 'throbber',
),
'path' => $ajax_href,
);
}
$tabs[$i] = $tablink;
}
}
return $tabs;
}