You are here

public function AmpAnalyticsSettingsForm::submitForm in Accelerated Mobile Pages (AMP) 8.3

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/AmpAnalyticsSettingsForm.php, line 161

Class

AmpAnalyticsSettingsForm
Defines the configuration export form.

Namespace

Drupal\amp\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $config = $this
    ->config('amp.analytics.settings');
  $config
    ->set('google_analytics_id', $form_state
    ->getValue('google_analytics_id'))
    ->save();
  $config
    ->set('amp_gtm_id', $form_state
    ->getValue('amp_gtm_id'))
    ->save();
  $config
    ->set('amp_pixel', $form_state
    ->getValue('amp_pixel'))
    ->save();
  $config
    ->set('amp_pixel_domain_name', $form_state
    ->getValue('amp_pixel_domain_name'))
    ->save();
  $config
    ->set('amp_pixel_query_string', $form_state
    ->getValue('amp_pixel_query_string'))
    ->save();
  $config
    ->set('amp_pixel_random_number', $form_state
    ->getValue('amp_pixel_random_number'))
    ->save();
  parent::submitForm($form, $form_state);
}