You are here

public function TransactionnalEmailForm::submitForm in SendinBlue 8

Same name and namespace in other branches
  1. 8.2 src/Form/TransactionnalEmailForm.php \Drupal\sendinblue\Form\TransactionnalEmailForm::submitForm()

Form submission 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 ConfigFormBase::submitForm

File

src/Form/TransactionnalEmailForm.php, line 155

Class

TransactionnalEmailForm
Class Form Transactionnal emails SMTP.

Namespace

Drupal\sendinblue\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $sendEmail = $form_state
    ->getValue('sendinblue_to_email');
  $sendinblueOn = $form_state
    ->getValue('sendinblue_on');
  $config = $this
    ->configFactory()
    ->getEditable(SendinblueManager::CONFIG_SETTINGS_SEND_EMAIL);
  $config
    ->set('sendinblue_on', $sendinblueOn)
    ->save();
  if ((bool) $sendinblueOn) {
    $this->sendinblueManager
      ->sendEmail('test', $sendEmail);
    $this->sendinblueManager
      ->updateSmtpDetails();
  }
  parent::submitForm($form, $form_state);
}