function AccessPolicyBase::getPersistentCacheContexts

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Session/AccessPolicyBase.php \Drupal\Core\Session\AccessPolicyBase::getPersistentCacheContexts()
  2. 10 core/lib/Drupal/Core/Session/AccessPolicyBase.php \Drupal\Core\Session\AccessPolicyBase::getPersistentCacheContexts()

Gets the persistent cache contexts.

These inform the system what your access policy's calculations always vary by. If you have any further cache contexts that you want to conditionally add, you can do so in calculatePermissions and alterPermissions.

Return value

string[] The persistent cache contexts.

Overrides AccessPolicyInterface::getPersistentCacheContexts

1 call to AccessPolicyBase::getPersistentCacheContexts()
AccessPolicyBase::calculatePermissions in core/lib/Drupal/Core/Session/AccessPolicyBase.php
9 methods override AccessPolicyBase::getPersistentCacheContexts()
AlwaysAddsAccessPolicy::getPersistentCacheContexts in core/tests/Drupal/Tests/Core/Session/AccessPolicyProcessorTest.php
AlwaysAltersAccessPolicy::getPersistentCacheContexts in core/tests/Drupal/Tests/Core/Session/AccessPolicyProcessorTest.php
BarAccessPolicy::getPersistentCacheContexts in core/tests/Drupal/Tests/Core/Session/AccessPolicyProcessorTest.php
BazAccessPolicy::getPersistentCacheContexts in core/tests/Drupal/Tests/Core/Session/AccessPolicyProcessorTest.php
FooAccessPolicy::getPersistentCacheContexts in core/tests/Drupal/Tests/Core/Session/AccessPolicyProcessorTest.php

... See full list

File

core/lib/Drupal/Core/Session/AccessPolicyBase.php, line 32

Class

AccessPolicyBase
Base class for access policies.

Namespace

Drupal\Core\Session

Code

public function getPersistentCacheContexts() : array {
  return [];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.