You are here

public function MessageSettingsForm::submitForm in Message 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/MessageSettingsForm.php, line 121

Class

MessageSettingsForm
Configure file system settings for this site.

Namespace

Drupal\message\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  parent::submitForm($form, $form_state);
  $config = $this
    ->config('message.settings');
  foreach ($this
    ->defaultKeys() as $key) {
    $config
      ->set($key, $form_state
      ->getValue($key));
  }
  $purge_enable = $form_state
    ->getValue([
    'settings',
    'purge_enable',
  ]);
  $config
    ->set('purge_enable', $purge_enable);
  $config
    ->set('purge_methods', $purge_enable ? $this->purgeManager
    ->getPurgeConfiguration($form, $form_state) : []);
  $config
    ->save();
}