function NumericArgument::buildOptionsForm

Same name in other branches
  1. 9 core/modules/views/src/Plugin/views/argument/NumericArgument.php \Drupal\views\Plugin\views\argument\NumericArgument::buildOptionsForm()
  2. 8.9.x core/modules/views/src/Plugin/views/argument/NumericArgument.php \Drupal\views\Plugin\views\argument\NumericArgument::buildOptionsForm()
  3. 11.x core/modules/views/src/Plugin/views/argument/NumericArgument.php \Drupal\views\Plugin\views\argument\NumericArgument::buildOptionsForm()

Overrides ArgumentPluginBase::buildOptionsForm

1 method overrides NumericArgument::buildOptionsForm()
NumberListField::buildOptionsForm in core/modules/options/src/Plugin/views/argument/NumberListField.php
Provide a form to edit options for this plugin.

File

core/modules/views/src/Plugin/views/argument/NumericArgument.php, line 36

Class

NumericArgument
Basic argument handler for arguments that are numeric.

Namespace

Drupal\views\Plugin\views\argument

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
    parent::buildOptionsForm($form, $form_state);
    // Allow '+' for "or". Allow ',' for "and".
    $form['break_phrase'] = [
        '#type' => 'checkbox',
        '#title' => $this->t('Allow multiple values'),
        '#description' => $this->t('If selected, users can enter multiple values in the form of 1+2+3 (for OR) or 1,2,3 (for AND).'),
        '#default_value' => !empty($this->options['break_phrase']),
        '#group' => 'options][more',
    ];
    $form['not'] = [
        '#type' => 'checkbox',
        '#title' => $this->t('Exclude'),
        '#description' => $this->t('If selected, the numbers entered for the filter will be excluded rather than limiting the view.'),
        '#default_value' => !empty($this->options['not']),
        '#group' => 'options][more',
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.