You are here

public function StyledGoogleMapSettingsForm::submitForm in Styled Google Map 8.2

Same name and namespace in other branches
  1. 8 src/Form/styledGoogleMapSettingsForm.php \Drupal\styled_google_map\Form\styledGoogleMapSettingsForm::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/StyledGoogleMapSettingsForm.php, line 122

Class

StyledGoogleMapSettingsForm
Configure example settings for this site.

Namespace

Drupal\styled_google_map\Form

Code

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

  /** @var \Drupal\Core\Config\Config $config */
  $config = \Drupal::service('config.factory')
    ->getEditable('styled_google_map.settings');
  $config
    ->set('styled_google_map_google_auth_method', $form_state
    ->getValue('styled_google_map_google_auth_method'))
    ->set('styled_google_map_google_apikey', $form_state
    ->getValue('styled_google_map_google_apikey'))
    ->set('styled_google_map_google_client_id', $form_state
    ->getValue('styled_google_map_google_client_id'))
    ->set('styled_google_map_libraries', $form_state
    ->getValue('styled_google_map_libraries'))
    ->save();
  $this->libraryDiscovery
    ->clearCachedDefinitions();
  parent::submitForm($form, $form_state);
}