Same name and namespace in other branches
  1. 8.9.x core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php \Drupal\taxonomy\Plugin\views\filter\TaxonomyIndexTid::valueValidate()
  2. 9 core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php \Drupal\taxonomy\Plugin\views\filter\TaxonomyIndexTid::valueValidate()

File

core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php, line 287

Class

TaxonomyIndexTid

Namespace

Drupal\taxonomy\Plugin\views\filter

Code

protected function valueValidate($form, FormStateInterface $form_state) {

  // We only validate if they've chosen the text field style.
  if ($this->options['type'] != 'textfield') {
    return;
  }
  $tids = [];
  if ($values = $form_state
    ->getValue([
    'options',
    'value',
  ])) {
    foreach ($values as $value) {
      $tids[] = $value['target_id'];
    }
  }
  $form_state
    ->setValue([
    'options',
    'value',
  ], $tids);
}