You are here

public function LoginShadowboxSettingsForm::validateForm in Shadowbox 8

Implements \Drupal\Core\Form\FormInterface::validateForm().

Overrides FormBase::validateForm

File

login_shadowbox/lib/Drupal/login_shadowbox/Form/LoginShadowboxSettingsForm.php, line 128
Contains \Drupal\login_shadowbox\Form\LoginShadowboxSettingsForm.

Class

LoginShadowboxSettingsForm
Configure the Shadowbox login settings.

Namespace

Drupal\login_shadowbox\Form

Code

public function validateForm(array &$form, array &$form_state) {
  parent::validateForm($form, $form_state);
  $width = $form_state['values']['login_shadowbox_width'];
  $height = $form_state['values']['login_shadowbox_height'];
  if (!is_numeric($width) || $width < 0) {
    $this
      ->setFormError('login_shadowbox_width', $form_state, $this
      ->t('You must enter a positive number.'));
  }
  if (!is_numeric($height) || $height < 0) {
    $this
      ->setFormError('login_shadowbox_height', $form_state, $this
      ->t('You must enter a positive number.'));
  }
}