Same name in other branches
- 8.x-1.x src/Plugin/QuickRender/QuickAccordion.php \Drupal\quicktabs\Plugin\QuickRender\QuickAccordion::render()
Overrides QuickRenderer::render
Fichier
-
plugins/
QuickAccordion.inc, line 33
Classe
- QuickAccordion
- Renders the content using the jQuery UI Accordion widget.
Code
public function render() {
$quickset = $this->quickset;
$qsid = 'quickset-' . $quickset->getName();
// Build our render array...
$render_array = array();
$render_array['#attached'] = $this->add_attached();
$render_array['content'] = array(
'#theme' => 'qt_accordion',
'#options' => array(
'attributes' => array(
'id' => $qsid,
'class' => array(
'quick-accordion',
),
),
),
'divs' => array(),
);
// Render all tab content.
foreach ($quickset->getContents() as $key => $item) {
if (!empty($item)) {
$attributes = array();
$attributes['class'][] = drupal_html_class($item->getTitle());
drupal_alter('quicktabs_tablinks_attributes', $attributes, $quickset, $key);
$attributes['href'] = '#' . $qsid . '_' . $key;
$render_array['content']['divs'][] = array(
'#prefix' => '<h3><a ' . drupal_attributes($attributes) . '>' . check_plain($quickset->translateString($item->getTitle(), 'tab', $key)) . '</a></h3><div>',
'#suffix' => '</div>',
'content' => $item->render(),
);
}
}
return $render_array;
}