public function AdminSettingsForm::submitForm in Googalytics - Google Analytics 8
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/ AdminSettingsForm.php, line 221
Class
- AdminSettingsForm
- Form for editing Google Analytics settings.
Namespace
Drupal\ga\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$this
->config('ga.settings')
->set('add_default_commands', $form_state
->getValue('add_default_commands'))
->set('premium', $form_state
->getValue('premium'))
->set('tracking_id', $form_state
->getValue('tracking_id'))
->set('sample_rate', $form_state
->getValue('sample_rate'))
->set('site_speed_sample_rate', $form_state
->getValue('site_speed_sample_rate'))
->set('force_ssl', $form_state
->getValue('force_ssl'))
->set('send_pageview', $form_state
->getValue('send_pageview'))
->set('plugins.linkid', $form_state
->getValue([
'plugins',
'linkid',
]))
->set('plugins.displayfeatures', $form_state
->getValue([
'plugins',
'displayfeatures',
]))
->set('plugins.linker.enable', $form_state
->getValue([
'plugins',
'linker',
]))
->set('plugins.linker.domains', array_filter(preg_split('/, ?/', $form_state
->getValue([
'plugins',
'linker_domains',
]))))
->set('track_user_id', $form_state
->getValue('track_user_id'))
->set('user_roles.mode', $form_state
->getValue([
'user_roles',
'mode',
]))
->set('user_roles.roles', array_values(array_filter($form_state
->getValue([
'user_roles',
'roles',
]))))
->set('anonymize_ip', $form_state
->getValue('anonymize_ip'))
->save();
parent::submitForm($form, $form_state);
}