You are here

public function ToolbarThemesSettingsForm::submitForm in Toolbar Themes 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/ToolbarThemesSettingsForm.php, line 178

Class

ToolbarThemesSettingsForm
Toobar themes settings form.

Namespace

Drupal\toolbar_themes\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $values = $form_state
    ->getValues();
  $config = \Drupal::service('config.factory')
    ->getEditable('toolbar_themes.settings');
  foreach ($values['settings'] as $key => $setting) {
    $config
      ->set($key, $setting);
  }
  $config
    ->save();
  parent::submitForm($form, $form_state);
  drupal_flush_all_caches();
}