Same name in other branches
- 8.x-1.x src/Plugin/QuickRender/QuickUiTabs.php \Drupal\quicktabs\Plugin\QuickRender\QuickUiTabs::add_attached()
Add any necessary js, css and libraries for the render array.
1 call to QuickUiTabs::add_attached()
- QuickUiTabs::render dans plugins/
QuickUiTabs.inc - The only method that renderer plugins must implement.
Fichier
-
plugins/
QuickUiTabs.inc, line 83
Classe
- QuickUiTabs
- Renders the content using the jQuery UI Tabs widget.
Code
protected function add_attached() {
$active_tab = $this->quickset
->getActiveTab();
$settings = $this->quickset
->getSettings();
$options = $settings['options'];
$attached = array(
'library' => array(
array(
'system',
'ui.tabs',
),
array(
'system',
'jquery.bbq',
),
),
'js' => array(
array(
'data' => drupal_get_path('module', 'quicktabs') . '/js/qt_ui_tabs.js',
'weight' => JS_DEFAULT + 1,
),
),
);
$javascript = drupal_add_js();
if (isset($javascript['settings']['data'])) {
foreach ($javascript['settings']['data'] as $key => $settings) {
if (key($settings) == 'quicktabs') {
$qtkey = $key;
break;
}
}
}
if ($options['history']) {
$attached['library'][] = array(
'system',
'jquery.bbq',
);
$attached['js'][] = array(
'data' => drupal_get_path('module', 'quicktabs') . '/js/quicktabs_bbq.js',
'weight' => JS_DEFAULT,
);
}
$name = $this->quickset
->getName();
if (!isset($qtkey) || !array_key_exists('qt_' . $name, $javascript['settings']['data'][$qtkey]['quicktabs'])) {
$quicktabs_array = array(
'name' => $name,
'active_tab' => $this->quickset
->getActiveTab(),
'history' => $options['history'],
);
$attached['js'][] = array(
'data' => array(
'quicktabs' => array(
'qt_' . $name => $quicktabs_array,
),
),
'type' => 'setting',
);
}
return $attached;
}