public function Search::validateExposed in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/modules/search/src/Plugin/views/filter/Search.php \Drupal\search\Plugin\views\filter\Search::validateExposed()
Validate the exposed handler form
Overrides HandlerBase::validateExposed
File
- core/
modules/ search/ src/ Plugin/ views/ filter/ Search.php, line 102 - Contains \Drupal\search\Plugin\views\filter\Search.
Class
- Search
- Filter handler for search keywords.
Namespace
Drupal\search\Plugin\views\filterCode
public function validateExposed(&$form, FormStateInterface $form_state) {
if (!isset($this->options['expose']['identifier'])) {
return;
}
$key = $this->options['expose']['identifier'];
if (!$form_state
->isValueEmpty($key)) {
$this
->queryParseSearchExpression($form_state
->getValue($key));
if (count($this->searchQuery
->words()) == 0) {
$form_state
->setErrorByName($key, $this
->formatPlural(\Drupal::config('search.settings')
->get('index.minimum_word_size'), 'You must include at least one keyword to match in the content, and punctuation is ignored.', 'You must include at least one keyword to match in the content. Keywords must be at least @count characters, and punctuation is ignored.'));
}
}
}