You are here

public function NullArgument::buildOptionsForm in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/views/src/Plugin/views/argument/NullArgument.php \Drupal\views\Plugin\views\argument\NullArgument::buildOptionsForm()

Override buildOptionsForm() so that only the relevant options are displayed to the user.

Overrides ArgumentPluginBase::buildOptionsForm

File

core/modules/views/src/Plugin/views/argument/NullArgument.php, line 26

Class

NullArgument
Argument handler that ignores the argument.

Namespace

Drupal\views\Plugin\views\argument

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  parent::buildOptionsForm($form, $form_state);
  $form['must_not_be'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Fail basic validation if any argument is given'),
    '#default_value' => !empty($this->options['must_not_be']),
    '#description' => $this
      ->t('By checking this field, you can use this to make sure views with more arguments than necessary fail validation.'),
    '#group' => 'options][more',
  ];
  unset($form['exception']);
}