public function ProtectedSubmissionsForm::validateForm in Protected Submissions 8
Form validation handler.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Overrides FormBase::validateForm
File
- src/
Form/ ProtectedSubmissionsForm.php, line 273
Class
- ProtectedSubmissionsForm
- ProtectedSubmissionsForm class.
Namespace
Drupal\protected_submissions\FormCode
public function validateForm(array &$form, FormStateInterface $form_state) {
if (strlen($form_state
->getValue('reject_message')) == 0) {
$form_state
->setErrorByName('user', $this
->t('You must enter a reject message to be displayed when an undesired pattern is detected on submission.'));
}
elseif (strlen($form_state
->getValue('reject_patterns')) == 0) {
$form_state
->setErrorByName('user', $this
->t('You must enter the pattern(s) to trigger a submission rejection when matched.'));
}
}