You are here

public function CookiebotForm::submitForm in Cookiebot - Cookie consent, Cookie monitoring and Cookie control 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/CookiebotForm.php, line 254

Class

CookiebotForm
Cookiebot settings form.

Namespace

Drupal\cookiebot\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  parent::submitForm($form, $form_state);
  $this->cacheTagsInvalidator
    ->invalidateTags([
    'cookiebot:cbid',
    'cookiebot:show_declaration',
    'cookiebot:iab_enabled',
  ]);
  $this
    ->config('cookiebot.settings')
    ->set('cookiebot_cbid', $form_state
    ->getValue('cookiebot_cbid'))
    ->set('cookiebot_block_cookies', $form_state
    ->getValue('cookiebot_block_cookies'))
    ->set('cookiebot_iab_enabled', $form_state
    ->getValue('cookiebot_iab_enabled'))
    ->set('cookiebot_show_declaration', $form_state
    ->getValue('cookiebot_show_declaration'))
    ->set('cookiebot_show_declaration_node_path', $this->aliasManager
    ->getAliasByPath('/node/' . $form_state
    ->getValue('cookiebot_show_declaration_node_path')))
    ->set('exclude_paths', $form_state
    ->getValue('exclude_paths'))
    ->set('exclude_admin_theme', $form_state
    ->getValue('exclude_admin_theme'))
    ->set('exclude_uid_1', $form_state
    ->getValue('exclude_uid_1'))
    ->set('message_placeholder_cookieconsent_optout_marketing_show', $form_state
    ->getValue('message_placeholder_cookieconsent_optout_marketing_show'))
    ->set('message_placeholder_cookieconsent_optout_marketing', $form_state
    ->getValue('message_placeholder_cookieconsent_optout_marketing'))
    ->save();
}