protected function SnippetBuilder::pageAttachmentDrupalSettings in Hotjar 8.2
Add page attachments when DrupalSettings mode is in use.
1 call to SnippetBuilder::pageAttachmentDrupalSettings()
- SnippetBuilder::pageAttachment in src/
SnippetBuilder.php - Implements hook_page_attachment().
File
- src/
SnippetBuilder.php, line 159
Class
- SnippetBuilder
- Snippet builder service.
Namespace
Drupal\hotjarCode
protected function pageAttachmentDrupalSettings(array &$attachments) {
// Assets resolver will escape drupalSettings.
$clean_id = Html::escape((string) $this->settings
->getSetting('account'));
$clean_version = Html::escape($this->settings
->getSetting('snippet_version'));
$attachments['#attached']['drupalSettings']['hotjar']['account'] = $clean_id;
$attachments['#attached']['drupalSettings']['hotjar']['snippetVersion'] = $clean_version;
$attachments['#attached']['library'][] = 'hotjar/hotjar';
}