You are here

public function BlockerSettingsForm::submitForm in Cookie Content Blocker 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/BlockerSettingsForm.php, line 133

Class

BlockerSettingsForm
Form builder to manage settings related to the Cookie content blocker.

Namespace

Drupal\cookie_content_blocker\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) : void {
  parent::submitForm($form, $form_state);
  $config = $this
    ->config('cookie_content_blocker.settings');
  $config
    ->set('blocked_message', $form_state
    ->getValue('blocked_message'));
  $config
    ->set('show_button', $form_state
    ->getValue('show_button'));
  $config
    ->set('button_text', $form_state
    ->getValue('button_text'));
  $config
    ->set('enable_click_consent_change', $form_state
    ->getValue('enable_click_consent_change'));
  $config
    ->set('consent_awareness', $form_state
    ->getValue('consent_awareness'));
  $config
    ->save();
}