function CalculatedCacheContextInterface::getContext

Same name in other branches
  1. 9 core/lib/Drupal/Core/Cache/Context/CalculatedCacheContextInterface.php \Drupal\Core\Cache\Context\CalculatedCacheContextInterface::getContext()
  2. 8.9.x core/lib/Drupal/Core/Cache/Context/CalculatedCacheContextInterface.php \Drupal\Core\Cache\Context\CalculatedCacheContextInterface::getContext()
  3. 10 core/lib/Drupal/Core/Cache/Context/CalculatedCacheContextInterface.php \Drupal\Core\Cache\Context\CalculatedCacheContextInterface::getContext()

Returns the string representation of the cache context.

A cache context service's name is used as a token (placeholder) cache key, and is then replaced with the string returned by this method.

Parameters

string|null $parameter: The parameter, or NULL to indicate all possible parameter values.

Return value

string The string representation of the cache context. When $parameter is NULL, a value representing all possible parameters must be generated.

Throws

\LogicException Thrown if the passed in parameter is invalid.

10 methods override CalculatedCacheContextInterface::getContext()
BazCacheContext::getContext in core/tests/Drupal/Tests/Core/Cache/Context/CacheContextsManagerTest.php
Returns the string representation of the cache context.
CookiesCacheContext::getContext in core/lib/Drupal/Core/Cache/Context/CookiesCacheContext.php
Returns the string representation of the cache context.
HeadersCacheContext::getContext in core/lib/Drupal/Core/Cache/Context/HeadersCacheContext.php
Returns the string representation of the cache context.
LanguagesCacheContext::getContext in core/lib/Drupal/Core/Cache/Context/LanguagesCacheContext.php
$type can be NULL, or one of the language types supported by the language manager, typically:
LayoutBuilderIsActiveCacheContext::getContext in core/modules/layout_builder/src/Cache/LayoutBuilderIsActiveCacheContext.php
Returns the string representation of the cache context.

... See full list

File

core/lib/Drupal/Core/Cache/Context/CalculatedCacheContextInterface.php, line 36

Class

CalculatedCacheContextInterface
Provides an interface for defining a calculated cache context service.

Namespace

Drupal\Core\Cache\Context

Code

public function getContext($parameter = NULL);

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