public function CookiesConfigForm::submitForm in COOKiES Consent Management 1.0.x
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/ CookiesConfigForm.php, line 232
Class
- CookiesConfigForm
- Form to configure the COOKiES module settings.
Namespace
Drupal\cookies\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
parent::submitForm($form, $form_state);
if ($form_state
->getValue('use_callback') === 0) {
// @todo to be removed before 1.1.x
$this
->config('cookies.config')
->clear('use_callback')
->clear('callback_method')
->clear('callback_url');
}
$this
->config('cookies.config')
->set('cookie_name', $form_state
->getValue('cookie_name'))
->set('cookie_expires', $form_state
->getValue('cookie_expires'))
->set('cookie_domain', $form_state
->getValue('cookie_domain'))
->set('cookie_secure', $form_state
->getValue('cookie_secure'))
->set('cookie_same_site', $form_state
->getValue('cookie_same_site'))
->set('open_settings_hash', $form_state
->getValue('open_settings_hash'))
->set('show_deny_all', $form_state
->getValue('show_deny_all'))
->set('settings_as_link', $form_state
->getValue('settings_as_link'))
->set('group_consent', $form_state
->getValue('group_consent'))
->set('cookie_docs', $form_state
->getValue('cookie_docs'))
->set('lib_load_from_cdn', $form_state
->getValue('lib_load_from_cdn'))
->set('lib_scroll_limit', $form_state
->getValue('lib_scroll_limit'))
->set('use_default_styles', $form_state
->getValue('use_default_styles'))
->set('store_auth_user_consent', $form_state
->getValue('store_auth_user_consent'))
->save();
}