Commit f9b536d8 authored by Thomas Fline's avatar Thomas Fline Committed by Vince Tikász
Browse files

Issue #3298655 by fengtan: Make Hotjar ID field optional

parent 26ff199f
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -82,11 +82,10 @@ class HotjarAdminSettingsForm extends ConfigFormBase {

    $form['general']['hotjar_account'] = [
      '#default_value' => $settings->get('account'),
      '#description' => $this->t('Your Hotjar ID can be found in your tracking code on the line <code>h._hjSettings={hjid:<b>12345</b>,hjsv::version};</code> where <code><b>12345</b></code> is your Hotjar ID', [
      '#description' => $this->t('Your Hotjar ID can be found in your tracking code on the line <code>h._hjSettings={hjid:<b>12345</b>,hjsv::version};</code> where <code><b>12345</b></code> is your Hotjar ID. Leave blank to disable Hotjar.', [
        ':version' => HotjarSettingsInterface::HOTJAR_SNIPPET_VERSION,
      ]),
      '#maxlength' => 20,
      '#required' => TRUE,
      '#size' => 15,
      '#title' => $this->t('Hotjar ID'),
      '#type' => 'textfield',
+5 −0
Original line number Diff line number Diff line
@@ -126,6 +126,11 @@ class SnippetBuilder implements SnippetBuilderInterface, ContainerInjectionInter
   * {@inheritdoc}
   */
  public function pageAttachment(array &$attachments) {
    // Do not attach Hotjar if no Hotjar ID was provided.
    if (empty($this->settings->getSetting('account'))) {
      return;
    }

    if ($this->settings->getSetting('attachment_mode') === HotjarSettingsInterface::ATTACHMENT_MODE_DRUPAL_SETTINGS) {
      $this->pageAttachmentDrupalSettings($attachments);
    }