You are here

public function AmazonSesSettingsForm::submitForm in Amazon SES 2.0.x

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/AmazonSesSettingsForm.php, line 63

Class

AmazonSesSettingsForm
Amazon SES settings form.

Namespace

Drupal\amazon_ses\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $config_keys = [
    'from_address',
    'queue',
  ];
  $config = $this
    ->config('amazon_ses.settings');
  foreach ($config_keys as $config_key) {
    if ($form_state
      ->hasValue($config_key)) {
      $config
        ->set($config_key, $form_state
        ->getValue($config_key));
    }
  }
  $config
    ->save();
  $this
    ->messenger()
    ->addMessage($this
    ->t('The settings have been saved.'));
}