You are here

public function YandexMapsSettings::submitForm in Geolocation Field 8.2

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

Class

YandexMapsSettings
Implements the Yandex Maps form controller.

Namespace

Drupal\geolocation_yandex\Form

Code

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

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