You are here

public function HereMapsSettings::submitForm in Geolocation Field 8.2

Same name and namespace in other branches
  1. 8.3 modules/geolocation_here/src/Form/HereMapsSettings.php \Drupal\geolocation_here\Form\HereMapsSettings::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/geolocation_here/src/Form/HereMapsSettings.php, line 56

Class

HereMapsSettings
Implements the HERE Maps form controller.

Namespace

Drupal\geolocation_here\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $config = $this
    ->configFactory()
    ->getEditable('here_maps.settings');
  $config
    ->set('app_id', $form_state
    ->getValue('app_id'));
  $config
    ->set('app_code', $form_state
    ->getValue('app_code'));
  $config
    ->save();

  // Confirmation on form submission.
  \Drupal::messenger()
    ->addMessage($this
    ->t('The configuration options have been saved.'));
  drupal_flush_all_caches();
}