You are here

public function TransactionnalEmailForm::validateForm in SendinBlue 8

Same name and namespace in other branches
  1. 8.2 src/Form/TransactionnalEmailForm.php \Drupal\sendinblue\Form\TransactionnalEmailForm::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/TransactionnalEmailForm.php, line 136

Class

TransactionnalEmailForm
Class Form Transactionnal emails SMTP.

Namespace

Drupal\sendinblue\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  $sendEmail = $form_state
    ->getValue('sendinblue_to_email');
  if (!empty($sendEmail)) {
    if (!$this->emailValidator
      ->isValid($sendEmail)) {
      $form_state
        ->setErrorByName('sendinblue_to_email', $this
        ->t('The email address is invalid.'));
      return;
    }
  }
}