You are here

public function AdminForm::submitForm in Mime Mail 8

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/AdminForm.php, line 236

Class

AdminForm
Mime Mail administrative settings form.

Namespace

Drupal\mimemail\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $config = $this
    ->config('mimemail.settings');
  $config
    ->set('format', $form_state
    ->getValue('format'))
    ->set('name', $form_state
    ->getValue('name'))
    ->set('mail', $form_state
    ->getValue('mail'))
    ->set('simple_address', $form_state
    ->getValue('simple_address'))
    ->set('sitestyle', $form_state
    ->getValue('sitestyle'))
    ->set('textonly', $form_state
    ->getValue('textonly'))
    ->set('linkonly', $form_state
    ->getValue('linkonly'))
    ->set('user_plaintext_field', $form_state
    ->getValue('user_plaintext_field'))
    ->set('advanced.incoming', $form_state
    ->getValue('incoming'))
    ->set('advanced.key', $form_state
    ->getValue('key'));
  if ($form_state
    ->hasValue('preserve_class')) {

    // This form element is only present when mimemail_compress is enabled.
    $config
      ->set('preserve_class', $form_state
      ->getValue('preserve_class'));
  }
  $config
    ->save();
  parent::submitForm($form, $form_state);
}