You are here

public function ConfigForm::validateForm in Node.js integration 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

nodejs_notify/src/Form/ConfigForm.php, line 39

Class

ConfigForm
Class ConfigForm

Namespace

Drupal\nodejs_notify\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  if (!preg_match('/^\\d+$/', $form_state
    ->getValue('notification_lifetime_seconds'))) {
    $form_state
      ->setErrorByName('notification_lifetime_seconds', $this
      ->t('The notification lifetime must be a number.'));
  }
}