function InOperator::valueSubmit

Same name in other branches
  1. 9 core/modules/views/src/Plugin/views/filter/InOperator.php \Drupal\views\Plugin\views\filter\InOperator::valueSubmit()
  2. 8.9.x core/modules/views/src/Plugin/views/filter/InOperator.php \Drupal\views\Plugin\views\filter\InOperator::valueSubmit()
  3. 10 core/modules/views/src/Plugin/views/filter/InOperator.php \Drupal\views\Plugin\views\filter\InOperator::valueSubmit()

Overrides FilterPluginBase::valueSubmit

3 methods override InOperator::valueSubmit()
EntityReference::valueSubmit in core/modules/views/src/Plugin/views/filter/EntityReference.php
Perform any necessary changes to the form values prior to storage.
Name::valueSubmit in core/modules/user/src/Plugin/views/filter/Name.php
Perform any necessary changes to the form values prior to storage.
TaxonomyIndexTid::valueSubmit in core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php
Perform any necessary changes to the form values prior to storage.

File

core/modules/views/src/Plugin/views/filter/InOperator.php, line 310

Class

InOperator
Simple filter to handle matching of multiple options selectable via checkboxes.

Namespace

Drupal\views\Plugin\views\filter

Code

protected function valueSubmit($form, FormStateInterface $form_state) {
    // Drupal's FAPI system automatically puts '0' in for any checkbox that
    // was not set, and the key to the checkbox if it is set.
    // Unfortunately, this means that if the key to that checkbox is 0,
    // we are unable to tell if that checkbox was set or not.
    // Luckily, the '#value' on the checkboxes form actually contains
    // *only* a list of checkboxes that were set, and we can use that
    // instead.
    $form_state->setValue([
        'options',
        'value',
    ], $form['value']['#value']);
}

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