Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. CalculatedCacheContextInterface.php

function 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);

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal