public function SemanticViewsStyle::buildOptionsForm in Semantic Views 8.2
Provide a form to edit options for this plugin.
Overrides StylePluginBase::buildOptionsForm
File
- src/
Plugin/ views/ style/ SemanticViewsStyle.php, line 70
Class
- SemanticViewsStyle
- Style plugin to render each item in a slideshow.
Namespace
Drupal\semanticviews\Plugin\views\styleCode
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
// Group options.
$form['group'] = [
'#type' => 'fieldset',
'#title' => t('Grouping title'),
'#description' => t('If using groups, the view will insert the grouping’s title field.'),
'#attributes' => [
'class' => [
'clearfix',
],
],
];
$form['group']['element_type'] = [
'#prefix' => '<div class="views-left-30">',
'#suffix' => '</div>',
'#title' => t('Element'),
'#type' => 'textfield',
'#size' => '10',
'#default_value' => $this->options['group']['element_type'],
];
$form['group']['attributes'] = [
'#prefix' => '<div class="views-right-70">',
'#suffix' => '</div>',
'#title' => t('Element attributes'),
'#type' => 'textarea',
'#rows' => '5',
'#default_value' => $this->options['group']['attributes'],
'#description' => t('Enter one value per line, in the format attribute|value.'),
];
// List options.
$form['list'] = [
'#type' => 'fieldset',
'#title' => t('List'),
'#description' => t('If the output should be a HTML list, select the element and class attribute. The row element should also be set to %li.', [
'%li' => 'li',
]),
'#attributes' => [
'class' => [
'clearfix',
],
],
];
$form['list']['element_type'] = [
'#prefix' => '<div class="views-left-30">',
'#suffix' => '</div>',
'#type' => 'radios',
'#title' => t('List type'),
'#options' => [
'' => t('None'),
'ul' => t('Unordered list'),
'ol' => t('Ordered list'),
'dl' => t('Definition list'),
'div' => t('Division <div>'),
],
'#default_value' => $this->options['list']['element_type'],
];
$form['list']['attributes'] = [
'#prefix' => '<div class="views-right-70">',
'#suffix' => '</div>',
'#title' => t('Element attributes'),
'#type' => 'textarea',
'#rows' => '5',
'#default_value' => $this->options['list']['attributes'],
'#description' => t('Enter one value per line, in the format attribute|value.'),
];
// Row options.
$form['row'] = [
'#type' => 'fieldset',
'#title' => t('Row'),
'#attributes' => [
'class' => [
'clearfix',
],
],
];
$form['row']['element_type'] = [
'#prefix' => '<div class="clearfix"><div class="views-left-30">',
'#suffix' => '</div>',
'#title' => t('Element'),
'#type' => 'textfield',
'#size' => '10',
'#default_value' => $this->options['row']['element_type'],
];
$form['row']['attributes'] = [
'#prefix' => '<div class="views-right-70">',
'#suffix' => '</div>',
'#title' => t('Element attributes'),
'#type' => 'textarea',
'#rows' => '5',
'#default_value' => $this->options['row']['attributes'],
'#description' => t('Enter one value per line, in the format attribute|value. Insert %row-enumeration where you want row enumeration with start 0.', [
'%row-enumeration' => '{{ row_index }}',
]),
];
// First and last class options.
$form['row']['first_last'] = [
'#type' => 'fieldset',
'#title' => t('First and last classes'),
'#parents' => [
'style_options',
'row',
],
'#description' => t('If the %last_every_nth option is empty or zero, the %first_class and %last_class are added once to only the first and last rows in the pager set. If this option is greater than 1, these classes are added to every n<sup>th</sup> row, which may be useful for grid layouts where the initial and final unit’s lateral margins must be 0.', [
'%last_every_nth' => 'FIRST/LAST every nth',
'%first_class' => 'FIRST class attribute',
'%last_class' => 'LAST class attribute',
]),
'#attributes' => [
'class' => [
'clearfix',
],
],
];
$form['row']['first_last']['last_every_nth'] = [
'#type' => 'textfield',
'#size' => '10',
'#title' => t('FIRST/LAST every n<sup>th</sup>'),
'#default_value' => $this->options['row']['last_every_nth'],
];
$form['row']['first_last']['first_class'] = [
'#prefix' => '<div class="views-left-50">',
'#suffix' => '</div>',
'#title' => t('FIRST class attribute'),
'#type' => 'textfield',
'#size' => '30',
'#default_value' => $this->options['row']['first_class'],
];
$form['row']['first_last']['last_class'] = [
'#prefix' => '<div class="views-right-50">',
'#suffix' => '</div>',
'#title' => t('LAST class attribute'),
'#type' => 'textfield',
'#size' => '30',
'#default_value' => $this->options['row']['last_class'],
];
// Striping class options.
$form['row']['striping_classes'] = [
'#title' => t('Striping class attributes'),
'#type' => 'textfield',
'#size' => '30',
'#default_value' => $this->options['row']['striping_classes'],
'#description' => t('One striping class attribute is applied to each row. Separate multiple attributes with a space.'),
];
}