protected function QuickQuicktabs::construct_link_options in Quick Tabs 7.3
Helper function to construct link options for tab links.
1 call to QuickQuicktabs::construct_link_options()
- QuickQuicktabs::build_tablinks in plugins/
QuickQuicktabs.inc - Build the actual tab links, with appropriate href, title and attributes.
File
- plugins/
QuickQuicktabs.inc, line 149
Class
- QuickQuicktabs
- Renders the content using the original Quicktabs mechanism of previous versions. Includes support for ajax rendered content.
Code
protected function construct_link_options($tabkey) {
$qt_name = $this->quickset
->getName();
$settings = $this->quickset
->getSettings();
$contents = $this->quickset
->getContents();
$tab_type = $contents[$tabkey]
->getType();
$tab_unique_keys = $contents[$tabkey]
->getUniqueKeys();
$tab_settings = $contents[$tabkey]
->getSettings();
$id = 'quicktabs-tab-' . implode('-', array(
$qt_name,
$tabkey,
));
$classes = array(
'quicktabs-tab',
'quicktabs-tab-' . $tab_type,
);
// Generate unique class for the quicktab.
$key_contents = array();
foreach ($tab_unique_keys as $key) {
if (isset($tab_settings[$key])) {
$key_content = $tab_settings[$key];
$key_content = str_replace(array(
'_',
' ',
), '-', $key_content);
$key_content = preg_replace('/[^A-Za-z0-9\\-]/', '', $key_content);
$key_contents[] = $key_content;
}
}
$suffix = implode('-', $key_contents);
// Encode class suffixes longer than 50 as hash using md5.
if (strlen($suffix) > 50) {
$suffix = md5($suffix);
}
if (strlen($suffix) > 0) {
$classes[] = 'quicktabs-tab-' . $tab_type . '-' . $suffix;
}
// Need to construct the correct querystring for the tab links.
$query = drupal_get_query_parameters(NULL, array(
"qt-{$qt_name}",
'q',
'page',
));
$query["qt-{$qt_name}"] = $tabkey;
$link_options = array(
'attributes' => array(
'id' => $id,
'class' => $classes,
),
'query' => $query,
'fragment' => 'qt-' . $qt_name,
'html' => isset($settings['html']) ? $settings['html'] : FALSE,
);
return $link_options;
}