public function ViewsRowsWrapper::buildOptionsForm in Views Rows Wrapper 8
Same name and namespace in other branches
- 8.2 src/Plugin/views/style/ViewsRowsWrapper.php \Drupal\views_rows_wrapper\Plugin\views\style\ViewsRowsWrapper::buildOptionsForm()
Provide a form to edit options for this plugin.
Overrides StylePluginBase::buildOptionsForm
File
- src/
Plugin/ views/ style/ ViewsRowsWrapper.php, line 59
Class
- ViewsRowsWrapper
- A Views style that renders markup for Bootstrap tabs.
Namespace
Drupal\views_rows_wrapper\Plugin\views\styleCode
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
$form['use_wrapper'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Use this row wrapper'),
'#default_value' => $this->options['use_wrapper'],
'#description' => $this
->t('Check if you want to use this plugin.'),
];
$form['element_type'] = [
'#type' => 'select',
'#title' => $this
->t('Element type'),
'#options' => $this->options['element_types'],
'#default_value' => $this->options['element_type'],
'#description' => $this
->t('Select element type.'),
];
$form['attribute_type'] = [
'#type' => 'select',
'#title' => $this
->t('Attribute type'),
'#options' => $this->options['attribute_types'],
'#default_value' => $this->options['attribute_type'],
'#description' => $this
->t('Select attribute type.'),
];
$form['attribute_name'] = [
'#title' => $this
->t('Class/ID attribute name(s)'),
'#type' => 'textfield',
'#default_value' => $this->options['attribute_name'],
];
$form['rows_number'] = [
'#type' => 'number',
'#title' => $this
->t('Number of rows to wrap'),
'#min' => 1,
'#default_value' => $this->options['rows_number'],
'#description' => $this
->t('Choose the number of rows to be wrapped by selected element.'),
];
$form['wrap_method'] = [
'#type' => 'radios',
'#title' => $this
->t('Wrap method'),
'#default_value' => $this->options['wrap_method'],
'#options' => [
0 => $this
->t('Apply to all items'),
1 => $this
->t('Wrap once (first rows only)'),
],
'#description' => $this
->t('Select the method of how you want to wrap your view results.'),
];
$form['default_rows'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Add views row classes'),
'#default_value' => $this->options['default_rows'],
'#description' => $this
->t('Add the default row classes like views-row-1 to the output. You can use this to quickly reduce the amount of markup the view provides by default, at the cost of making it more difficult to apply CSS.'),
];
$form['strip_rows'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Add striping (odd/even), first/last row classes'),
'#default_value' => $this->options['strip_rows'],
'#description' => $this
->t('Add css classes to the first and last line, as well as odd/even classes for striping.'),
];
}