You are here

public function NewsletterSettingsForm::submitForm in Simplenews 8

Same name and namespace in other branches
  1. 8.2 src/Form/NewsletterSettingsForm.php \Drupal\simplenews\Form\NewsletterSettingsForm::submitForm()
  2. 3.x src/Form/NewsletterSettingsForm.php \Drupal\simplenews\Form\NewsletterSettingsForm::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/NewsletterSettingsForm.php, line 89

Class

NewsletterSettingsForm
Configure simplenews newsletter settings.

Namespace

Drupal\simplenews\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $this
    ->config('simplenews.settings')
    ->set('newsletter.format', $form_state
    ->getValue('simplenews_format'))
    ->set('newsletter.priority', $form_state
    ->getValue('simplenews_priority'))
    ->set('newsletter.receipt', $form_state
    ->getValue('simplenews_receipt'))
    ->set('newsletter.from_name', $form_state
    ->getValue('simplenews_from_name'))
    ->set('newsletter.from_address', $form_state
    ->getValue('simplenews_from_address'))
    ->save();
  parent::submitForm($form, $form_state);
}