You are here

public function SettingsForm::submitForm in Sparkpost email 8.2

Same name in this branch
  1. 8.2 src/Form/SettingsForm.php \Drupal\sparkpost\Form\SettingsForm::submitForm()
  2. 8.2 modules/sparkpost_requeue/src/Form/SettingsForm.php \Drupal\sparkpost_requeue\Form\SettingsForm::submitForm()
Same name and namespace in other branches
  1. 8 src/Form/SettingsForm.php \Drupal\sparkpost\Form\SettingsForm::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/SettingsForm.php, line 151

Class

SettingsForm
Settings form for the Sparkpost module.

Namespace

Drupal\sparkpost\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  parent::submitForm($form, $form_state);
  $this
    ->config('sparkpost.settings')
    ->set('api_hostname', $form_state
    ->getValue('api_hostname'))
    ->set('api_key', $form_state
    ->getValue('api_key'))
    ->set('debug', $form_state
    ->getValue('debug'))
    ->set('sender_name', $form_state
    ->getValue('sender_name'))
    ->set('sender', $form_state
    ->getValue('sender'))
    ->set('format', $form_state
    ->getValue('format'))
    ->set('async', $form_state
    ->getValue('async'))
    ->set('skip_cron', $form_state
    ->getValue('skip_cron'))
    ->save();
}