Same name in other branches
- 7.x-3.x plugins/QuickAccordion.inc \QuickAccordion::add_attached()
Add any necessary js, css and libraries for the render array.
1 call to QuickAccordion::add_attached()
- QuickAccordion::render in src/
Plugin/ QuickRender/ QuickAccordion.php
File
-
src/
Plugin/ QuickRender/ QuickAccordion.php, line 79
Class
- QuickAccordion
- Renders the content using the jQuery UI Accordion widget.
Namespace
Drupal\quicktabs\Plugin\QuickRenderCode
protected function add_attached() {
$settings = $this->quickset
->getSettings();
$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;
}