You are here

public function SettingsForm::submitForm in Geocoder 8.2

Same name and namespace in other branches
  1. 8.3 src/Form/SettingsForm.php \Drupal\geocoder\Form\SettingsForm::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/SettingsForm.php, line 266

Class

SettingsForm
The geocoder settings form.

Namespace

Drupal\geocoder\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {

  // Get all the form state values, in an array structure.
  $form_state_values = $form_state
    ->getValues();
  $plugins_options = [];
  foreach ($form_state_values['plugins'] as $k => $plugin) {
    $plugins_options[$k] = $form_state_values['plugins'][$k]['options'];
  }
  $config = $this
    ->config('geocoder.settings');
  $config
    ->set('geocoder_presave_disabled', $form_state_values['geocoder_presave_disabled']);
  $config
    ->set('cache', $form_state_values['cache']);
  $config
    ->set('plugins_options', $plugins_options);
  $config
    ->save();
  parent::submitForm($form, $form_state);
}