You are here

public function EnvironmentIndicatorUISettingsForm::submitForm in Environment Indicator 8.3

Same name and namespace in other branches
  1. 4.x modules/environment_indicator_ui/src/Form/EnvironmentIndicatorUISettingsForm.php \Drupal\environment_indicator_ui\Form\EnvironmentIndicatorUISettingsForm::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

modules/environment_indicator_ui/src/Form/EnvironmentIndicatorUISettingsForm.php, line 75

Class

EnvironmentIndicatorUISettingsForm
Configuration form for Environment Indicator.

Namespace

Drupal\environment_indicator_ui\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $config = $this
    ->config('environment_indicator.indicator');
  $properties = [
    'name',
    'fg_color',
    'bg_color',
  ];
  array_walk($properties, function ($property) use ($config, $form_state) {
    $config
      ->set($property, $form_state
      ->getValue($property));
  });
  $config
    ->save();
  parent::submitForm($form, $form_state);
}