You are here

public function FieldsetStyle::buildOptionsForm in Views fieldset style plugin 8

Provide a form to edit options for this plugin.

Overrides StylePluginBase::buildOptionsForm

File

src/Plugin/views/style/FieldsetStyle.php, line 74
Contains \Drupal\views_fieldset\Plugin\views\style\FieldsetStyle.

Class

FieldsetStyle
Fieldset style plugin to render rows as fieldset.

Namespace

Drupal\views_fieldset\Plugin\views\style

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  parent::buildOptionsForm($form, $form_state);
  $options = array(
    '' => $this
      ->t('- None -'),
  );
  $field_labels = $this->displayHandler
    ->getFieldLabels(TRUE);
  $options += $field_labels;
  $form['title'] = array(
    '#type' => 'select',
    '#title' => $this
      ->t('Fieldset Title'),
    '#options' => $options,
    '#default_value' => $this->options['title'],
    '#description' => $this
      ->t('Choose the title of fieldset.'),
    '#weight' => -48,
  );
  $form['description'] = array(
    '#type' => 'select',
    '#title' => $this
      ->t('Fieldset Description'),
    '#options' => $options,
    '#default_value' => $this->options['description'],
    '#description' => $this
      ->t('Optional fieldset description.'),
    '#weight' => -47,
  );
}