You are here

public function GeofieldMapSettingsForm::submitForm in Geofield Map 8.2

Same name and namespace in other branches
  1. 8 src/Form/GeofieldMapSettingsForm.php \Drupal\geofield_map\Form\GeofieldMapSettingsForm::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/GeofieldMapSettingsForm.php, line 206

Class

GeofieldMapSettingsForm
Implements the GeofieldMapSettingsForm controller.

Namespace

Drupal\geofield_map\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $config = $this
    ->configFactory()
    ->getEditable('geofield_map.settings');
  $config
    ->set('gmap_api_key', $form_state
    ->getValue('gmap_api_key'));
  $config
    ->set('gmap_api_localization', $form_state
    ->getValue('gmap_api_localization'));
  $config
    ->set('theming', $form_state
    ->getValue('theming'));
  $config
    ->set('geocoder', $form_state
    ->getValue('geocoder'));
  $config
    ->save();

  // Confirmation on form submission.
  $this
    ->messenger()
    ->addMessage($this
    ->t('The Geofield Map configurations have been saved.'));
}