You are here

public function CalculatedCacheContextInterface::getContext in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Cache/Context/CalculatedCacheContextInterface.php \Drupal\Core\Cache\Context\CalculatedCacheContextInterface::getContext()
  2. 9 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.

9 methods override CalculatedCacheContextInterface::getContext()
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.
MenuActiveTrailsCacheContext::getContext in core/lib/Drupal/Core/Cache/Context/MenuActiveTrailsCacheContext.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);