You are here

public function Simplelogin::validateForm in SimpleLogin 8.6

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/Simplelogin.php, line 173
Contains \Drupal\simplelogin\Form\SettingsForm. Simplelogin settings form.

Class

Simplelogin
Defines a form that configure settings.

Namespace

Drupal\simplelogin\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  $background_image = $form_state
    ->getValue([
    'background_image',
  ]);
  $opacity = $form_state
    ->getValue([
    'background_opacity',
  ]);
  if (empty($background_image) && !empty($opacity)) {
    $form_state
      ->setErrorByName('background_image', "Opacity is applicable only for images. if image empty means we won't need Opacity. Please uncheck");
  }
}