FieldsetStyle.php in Views fieldset style plugin 8
File
src/Plugin/views/style/FieldsetStyle.php
View source
<?php
namespace Drupal\views_fieldset\Plugin\views\style;
use Drupal\Core\Form\FormStateInterface;
use Drupal\views\Plugin\views\style\StylePluginBase;
class FieldsetStyle extends StylePluginBase {
protected $usesRowPlugin = TRUE;
protected $usesRowClass = TRUE;
protected $usesGrouping = FALSE;
protected $usesFields = TRUE;
protected function defineOptions() {
$options = parent::defineOptions();
$options['title'] = array(
'default' => '',
);
$options['description'] = array(
'default' => '',
);
return $options;
}
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,
);
}
}