You are here

protected function SnippetAccess::cookieConstentCheck in Hotjar 8

Same name and namespace in other branches
  1. 8.2 src/SnippetAccess.php \Drupal\hotjar\SnippetAccess::cookieConstentCheck()

Check cookie constent settings.

Return value

\Drupal\Core\Access\AccessResult Result.

1 call to SnippetAccess::cookieConstentCheck()
SnippetAccess::check in src/SnippetAccess.php
Determines whether we add tracking code to page.

File

src/SnippetAccess.php, line 276

Class

SnippetAccess
Class SnippetAccess.

Namespace

Drupal\hotjar

Code

protected function cookieConstentCheck() {
  if ($this->moduleHandler
    ->moduleExists('eu_cookie_compliance')) {
    $config = $this->configFactory
      ->get('eu_cookie_compliance.settings');
    $disabled_javascripts = $config
      ->get('disabled_javascripts');
    $disabled_javascripts = _eu_cookie_compliance_explode_multiple_lines($disabled_javascripts);
    if (in_array('sites/default/files/hotjar/hotjar.script.js', $disabled_javascripts)) {
      return AccessResult::forbidden();
    }
  }
  return AccessResult::neutral();
}