function Name::validateExposed
Same name in other branches
- 8.9.x core/modules/user/src/Plugin/views/filter/Name.php \Drupal\user\Plugin\views\filter\Name::validateExposed()
- 10 core/modules/user/src/Plugin/views/filter/Name.php \Drupal\user\Plugin\views\filter\Name::validateExposed()
- 11.x core/modules/user/src/Plugin/views/filter/Name.php \Drupal\user\Plugin\views\filter\Name::validateExposed()
Overrides HandlerBase::validateExposed
File
-
core/
modules/ user/ src/ Plugin/ views/ filter/ Name.php, line 70
Class
- Name
- Filter handler for usernames.
Namespace
Drupal\user\Plugin\views\filterCode
public function validateExposed(&$form, FormStateInterface $form_state) {
if (empty($this->options['exposed'])) {
return;
}
if (empty($this->options['expose']['identifier'])) {
return;
}
$identifier = $this->options['expose']['identifier'];
$input = $form_state->getValue($identifier);
if ($this->options['is_grouped'] && isset($this->options['group_info']['group_items'][$input])) {
$this->operator = $this->options['group_info']['group_items'][$input]['operator'];
$input = $this->options['group_info']['group_items'][$input]['value'];
}
$uids = [];
$values = $form_state->getValue($identifier);
if ($values && (!$this->options['is_grouped'] || $this->options['is_grouped'] && $input != 'All')) {
foreach ($values as $value) {
$uids[] = $value['target_id'];
}
}
if ($uids) {
$this->validated_exposed_input = $uids;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.