public function RandomCaptchaTypeSettingsForm::validateForm in CAPTCHA Pack 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
- random_captcha_type/
src/ Form/ RandomCaptchaTypeSettingsForm.php, line 71
Class
- RandomCaptchaTypeSettingsForm
- Random CAPTCHA type settings form.
Namespace
Drupal\random_captcha_type\FormCode
public function validateForm(array &$form, FormStateInterface $form_state) {
// At least 2 CAPTCHA types should be selected.
if (count(array_filter($form_state
->getValue('random_captcha_type_enabled_types'))) < 2) {
$form_state
->setErrorByName('random_captcha_type_enabled_types', $this
->t('You should select at least two CAPTCHA types.'));
}
parent::validateForm($form, $form_state);
}