Same name in other branches
- 8.x-1.x src/Plugin/QuickRender/QuickAccordion.php \Drupal\quicktabs\Plugin\QuickRender\QuickAccordion::add_attached()
Add any necessary js, css and libraries for the render array.
1 call to QuickAccordion::add_attached()
- QuickAccordion::render in plugins/
QuickAccordion.inc - The only method that renderer plugins must implement.
File
-
plugins/
QuickAccordion.inc, line 68
Class
- QuickAccordion
- Renders the content using the jQuery UI Accordion widget.
Code
protected function add_attached() {
$settings = $this->quickset
->getSettings();
// Setting heightStyle option so accordions don't auto height with newer versions of jQuery UI
if (!isset($settings['options']['jquery_ui']['autoheight'])) {
$settings['options']['jquery_ui']['heightStyle'] = 'content';
}
$options = $settings['options'];
$attached = array(
'library' => array(
array(
'system',
'ui.accordion',
),
),
'js' => array(
array(
'data' => drupal_get_path('module', 'quicktabs') . '/js/qt_accordion.js',
),
),
);
$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',
);
}
$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(),
'options' => $options['jquery_ui'],
'history' => $options['history'],
);
$attached['js'][] = array(
'data' => array(
'quicktabs' => array(
'qt_' . $name => $quicktabs_array,
),
),
'type' => 'setting',
);
}
return $attached;
}