You are here

public function SettingsForm::validateForm in Multiple E-mail Addresses 2.x

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/SettingsForm.php, line 102
Contains \Drupal\multiple_email\Form\SettingsForm.

Class

SettingsForm
Form builder for the admin settings page.

Namespace

Drupal\multiple_email\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  if (!is_numeric($form_state
    ->getValue('confirm_attempts'))) {
    $form_state
      ->setErrorByName('confirm_attempts', $this
      ->t('Confirm attempts must be an number!'));
  }
  if (!is_numeric($form_state
    ->getValue('confirm_deadline'))) {
    $form_state
      ->setErrorByName('confirm_deadline', $this
      ->t('Confirm Days must be an number!'));
  }
}