You are here

public function Lightbox2IframeSettingsForm::validateForm in Lightbox2 8

Same name in this branch
  1. 8 src/Lightbox2IframeSettingsForm.php \Drupal\lightbox2\Lightbox2IframeSettingsForm::validateForm()
  2. 8 src/Form/Lightbox2IframeSettingsForm.php \Drupal\lightbox2\Form\Lightbox2IframeSettingsForm::validateForm()

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/Lightbox2IframeSettingsForm.php, line 89
Contains \Drupal\lightbox2\Form\Lightbox2IframeSettingsForm.

Class

Lightbox2IframeSettingsForm

Namespace

Drupal\lightbox2\Form

Code

public function validateForm(array &$form, \Drupal\Core\Form\FormStateInterface $form_state) {
  if (!is_numeric($form_state
    ->getValue([
    'lightbox2_default_frame_width',
  ]))) {
    $form_state
      ->setErrorByName('lightbox2_slideshow_interval', t('The "default width" value must be numeric.'));
  }
  if (!is_numeric($form_state
    ->getValue([
    'lightbox2_default_frame_height',
  ]))) {
    $form_state
      ->setErrorByName('lightbox2_slideshow_interval', t('The "default height" value must be numeric.'));
  }
}