function EntityReference::validateExposed
Same name and namespace in other branches
- main core/modules/views/src/Plugin/views/filter/EntityReference.php \Drupal\views\Plugin\views\filter\EntityReference::validateExposed()
Validate the exposed handler form.
Parameters
array $form: An alterable, associative array containing the structure of the form, passed by reference.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Overrides HandlerBase::validateExposed
File
-
core/
modules/ views/ src/ Plugin/ views/ filter/ EntityReference.php, line 621
Class
- EntityReference
- Filters a view by entity references.
Namespace
Drupal\views\Plugin\views\filterCode
public function validateExposed(&$form, FormStateInterface $form_state) : void {
if (empty($this->options['exposed'])) {
return;
}
$identifier = $this->options['expose']['identifier'];
// Set the validated exposed input from the select list when not the all
// value option.
if ($this->options['widget'] == static::WIDGET_SELECT) {
if ($form_state->getValue($identifier) != static::ALL_VALUE) {
$this->validatedExposedInput = (array) $form_state->getValue($identifier);
}
return;
}
if (empty($identifier)) {
return;
}
$values = $form_state->getValue($identifier);
if (!is_array($values)) {
return;
}
foreach ($values as $value) {
$this->validatedExposedInput[] = $value['target_id'];
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.