You are here

public function RoutePlannerSettingsForm::submitForm in Route Planner 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/RoutePlannerSettingsForm.php, line 28

Class

RoutePlannerSettingsForm

Namespace

Drupal\route_planner\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $config = $this->configFactory
    ->getEditable('route_planner.settings');
  foreach (Element::children($form) as $fieldset) {
    foreach (Element::children($form[$fieldset]) as $variable) {
      $config
        ->set($variable, $form_state
        ->getValue($variable));
    }
  }
  $config
    ->save();
  parent::submitForm($form, $form_state);
}