You are here

public function SettingsForm::submitForm in Multiple E-mail Addresses 2.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/SettingsForm.php, line 114
Contains \Drupal\multiple_email\Form\SettingsForm.

Class

SettingsForm
Form builder for the admin settings page.

Namespace

Drupal\multiple_email\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $this
    ->config('multiple_email.settings')
    ->set('hide_field', (bool) $form_state
    ->getValue('hide_field'))
    ->set('edit_emails', (bool) $form_state
    ->getValue('edit_emails'))
    ->set('confirm.attempts', (int) $form_state
    ->getValue('confirm_attempts'))
    ->set('confirm.deadline', (int) $form_state
    ->getValue('confirm_deadline'))
    ->save();
  $this
    ->config('multiple_email.mail')
    ->set('confirmation.subject', $form_state
    ->getValue('confirmation_subject'))
    ->set('confirmation.body', $form_state
    ->getValue('confirmation_body'))
    ->set('expiration.subject', $form_state
    ->getValue('expiration_subject'))
    ->set('expiration.body', $form_state
    ->getValue('expiration_body'))
    ->save();
  parent::submitForm($form, $form_state);
}