You are here

public function HotjarAdminSettingsForm::submitForm in Hotjar 8

Same name and namespace in other branches
  1. 8.2 src/Form/HotjarAdminSettingsForm.php \Drupal\hotjar\Form\HotjarAdminSettingsForm::submitForm()

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/HotjarAdminSettingsForm.php, line 212

Class

HotjarAdminSettingsForm
Configure Hotjar settings for this site.

Namespace

Drupal\hotjar\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $config = $this
    ->config('hotjar.settings');
  $config
    ->set('account', $form_state
    ->getValue('hotjar_account'))
    ->set('snippet_version', $form_state
    ->getValue('hotjar_snippet_version'))
    ->set('visibility_pages', $form_state
    ->getValue('hotjar_visibility_pages'))
    ->set('pages', $form_state
    ->getValue('hotjar_pages'))
    ->set('visibility_roles', $form_state
    ->getValue('hotjar_visibility_roles'))
    ->set('roles', $form_state
    ->getValue('hotjar_roles'))
    ->save();
  parent::submitForm($form, $form_state);
  $this->snippetBuilder
    ->createAssets();
}