You are here

public function CleanerSettingsForm::submitForm in Cleaner 8

Same name and namespace in other branches
  1. 8.2 src/Form/CleanerSettingsForm.php \Drupal\cleaner\Form\CleanerSettingsForm::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/CleanerSettingsForm.php, line 226

Class

CleanerSettingsForm
Class CleanerSettingsForm.

Namespace

Drupal\cleaner\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $config = \Drupal::configFactory()
    ->getEditable(CLEANER_SETTINGS);
  foreach ($form_state
    ->getValues() as $name => $value) {
    if (stripos($name, 'cleaner') !== FALSE) {
      $config
        ->set($name, $value);
    }
  }
  $config
    ->save();
  parent::submitForm($form, $form_state);
}