function _panopoly_search_form_validate in Panopoly Search 8.2
Validation callback for views_exposed_form() for our search views.
1 string reference to '_panopoly_search_form_validate'
File
- ./
panopoly_search.module, line 114 - Hooks for the panopoly_search module.
Code
function _panopoly_search_form_validate($form, FormStateInterface $form_state) {
// Don't do anything if 'keys' isn't specified at all.
$input = $form_state
->getUserInput();
if ($input['keys'] === NULL) {
return;
}
// Show error if 'keys' is specified, but empty.
$keys = trim($form_state
->getValue('keys'));
if (empty($keys)) {
$form_state
->setErrorByName('keys', t('Please enter some keywords.'));
}
}