protected function TaxonomyIndexTid::valueValidate in Drupal 10
Same name and namespace in other branches
- 8 core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php \Drupal\taxonomy\Plugin\views\filter\TaxonomyIndexTid::valueValidate()
- 9 core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php \Drupal\taxonomy\Plugin\views\filter\TaxonomyIndexTid::valueValidate()
Validate the options form.
Overrides FilterPluginBase::valueValidate
File
- core/
modules/ taxonomy/ src/ Plugin/ views/ filter/ TaxonomyIndexTid.php, line 287
Class
- TaxonomyIndexTid
- Filter by term id.
Namespace
Drupal\taxonomy\Plugin\views\filterCode
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);
}