You are here

public function AsciiArtCaptchaSettingsForm::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

ascii_art_captcha/src/Form/AsciiArtCaptchaSettingsForm.php, line 81

Class

AsciiArtCaptchaSettingsForm
Displays the pants settings form.

Namespace

Drupal\ascii_art_captcha\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  if (count(array_filter($form_state
    ->getValue('ascii_art_captcha_allowed_characters'))) < 1) {
    $form_state
      ->setErrorByName('ascii_art_captcha_allowed_characters', $this
      ->t('You should select at least one type of characters to use.'));
  }
  parent::validateForm($form, $form_state);
}