protected function SnippetAccess::statusCheckResult in Hotjar 8
Same name and namespace in other branches
- 8.2 src/SnippetAccess.php \Drupal\hotjar\SnippetAccess::statusCheckResult()
Check HTTP status.
Return value
\Drupal\Core\Access\AccessResult Result.
1 call to SnippetAccess::statusCheckResult()
- SnippetAccess::check in src/
SnippetAccess.php - Determines whether we add tracking code to page.
File
- src/
SnippetAccess.php, line 192
Class
- SnippetAccess
- Class SnippetAccess.
Namespace
Drupal\hotjarCode
protected function statusCheckResult() {
$request = $this->requestStack
->getCurrentRequest();
$status = NULL;
if ($exception = $request->attributes
->get('exception')) {
$status = $exception
->getStatusCode();
}
$not_tracked_status_codes = [
'403',
'404',
];
$result = !in_array($status, $not_tracked_status_codes);
return AccessResult::forbiddenIf(!$result);
}