You are here

public function Pattern::buildOptionsForm in UI Patterns 8

Provide a form for setting options.

Overrides Fields::buildOptionsForm

File

modules/ui_patterns_views/src/Plugin/views/row/Pattern.php, line 102

Class

Pattern
Pattern Views row plugin.

Namespace

Drupal\ui_patterns_views\Plugin\views\row

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  parent::buildOptionsForm($form, $form_state);
  $form['default_field_elements'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Provide default field wrapper elements'),
    '#default_value' => $this->options['default_field_elements'],
    '#description' => $this
      ->t('If not checked, fields that are not configured to customize their HTML elements will get no wrappers at all for their field, label and field + label wrappers. 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['hide_empty'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Hide empty fields'),
    '#default_value' => $this->options['hide_empty'],
    '#description' => $this
      ->t('Do not display fields, labels or markup for fields that are empty.'),
  ];
  $context = [
    'view' => $this->view,
  ];
  $this
    ->buildPatternDisplayForm($form, 'views_row', $context, $this->options);
}