You are here

public function HstsConfigForm::validateForm in HTTP Strict Transport Security 8

.

Overrides FormBase::validateForm

File

src/Form/HstsConfigForm.php, line 115
Contains \Drupal\hsts\Form\HstsConfigForm.

Class

HstsConfigForm
Implements a Hsts Config form.

Namespace

Drupal\hsts\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  if (!is_numeric($form_state
    ->getValue('max_age')) || $form_state
    ->getValue('max_age') < 0) {
    $form_state
      ->setErrorByName('max_age', t('Value is not a number or out of bounds.'));
  }
  parent::validateForm($form, $form_state);
}