public function ViewsBootstrapAccordion::buildOptionsForm in Views Bootstrap 8.4
Same name and namespace in other branches
- 8.3 src/Plugin/views/style/ViewsBootstrapAccordion.php \Drupal\views_bootstrap\Plugin\views\style\ViewsBootstrapAccordion::buildOptionsForm()
Render the given style.
Overrides StylePluginBase::buildOptionsForm
File
- src/
Plugin/ views/ style/ ViewsBootstrapAccordion.php, line 50
Class
- ViewsBootstrapAccordion
- Style plugin to render each item as a row in a Bootstrap Accordion.
Namespace
Drupal\views_bootstrap\Plugin\views\styleCode
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
if (isset($form['grouping'])) {
unset($form['grouping']);
$form['panel_title_field'] = [
'#type' => 'select',
'#title' => $this
->t('Panel title field'),
'#options' => $this->displayHandler
->getFieldLabels(TRUE),
'#required' => TRUE,
'#default_value' => $this->options['panel_title_field'],
'#description' => $this
->t('Select the field that will be used as the accordian panel titles.'),
];
}
$options_select = [
'0' => $this
->t('Collapsed'),
'1' => $this
->t('Uncollapsed'),
];
$form['collapse'] = [
'#type' => 'fieldset',
'#title' => $this
->t('Collapse options'),
];
$form['collapse']['first'] = [
'#type' => 'select',
'#title' => $this
->t('First element'),
'#options' => $options_select,
'#default_value' => $this->options['collapse']['first'],
'#description' => $this
->t('To collapse/uncollapse the first element of the list. If there is only one item, first element settings prevails than the others (middle, last)'),
];
$form['collapse']['middle'] = [
'#type' => 'select',
'#title' => $this
->t('Middle elements'),
'#options' => $options_select,
'#default_value' => $this->options['collapse']['middle'],
'#description' => $this
->t('To collapse/uncollapse the middle elements of the list.'),
];
$form['collapse']['last'] = [
'#type' => 'select',
'#title' => $this
->t('Last element'),
'#options' => $options_select,
'#default_value' => $this->options['collapse']['last'],
'#description' => $this
->t('To collapse/uncollapse the last element of the list.'),
];
}