You are here

public function WatchdogPruneSettings::submitForm in Watchdog Prune 8

Same name and namespace in other branches
  1. 8.2 src/Form/WatchdogPruneSettings.php \Drupal\watchdog_prune\Form\WatchdogPruneSettings::submitForm()

Implements submitForm().

Parameters

array $form: Processess $form.

\Drupal\Core\Form\FormStateInterface $form_state: Processess $form_state.

Overrides ConfigFormBase::submitForm

File

src/Form/WatchdogPruneSettings.php, line 132

Class

WatchdogPruneSettings
Class WatchdogPruneSettings.

Namespace

Drupal\watchdog_prune\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  parent::submitForm($form, $form_state);
  $watchdog_prune_age = $form_state
    ->getValue('watchdog_prune_age');
  $watchdog_prune_age_type = $form_state
    ->getValue('watchdog_prune_age_type');
  $this
    ->config('watchdog_prune.settings')
    ->set('watchdog_prune_age', $watchdog_prune_age)
    ->set('watchdog_prune_age_type', $watchdog_prune_age_type)
    ->save();
  \Drupal::messenger()
    ->addMessage('The configuration options have been saved.', 'status');
}