CacheContextsManager::convertTokensToKeys

public CacheContextsManager::convertTokensToKeys(array $context_tokens) Converts cache context tokens to cache keys. A cache context token is either: a cache context ID (if the service ID is 'cache_context.foo', then 'foo' is a cache context ID); for example, 'foo'. a calculated cache context ID, followed by a colon, followed by the parameter for the calculated cache context; for example, 'bar:some_parameter'. Parameters string[] $context_tokens: An array of cache context tokens. Return valu

CacheContextsManager::getLabels

public CacheContextsManager::getLabels($include_calculated_cache_contexts = FALSE) Provides an array of available cache context labels. To be used in cache configuration forms. Parameters bool $include_calculated_cache_contexts: Whether to also return calculated cache contexts. Default to FALSE. Return value array An array of available cache contexts and corresponding labels. File core/lib/Drupal/Core/Cache/Context/CacheContextsManager.php, line 73 Class CacheContextsManager Converts cac

CacheContextsManager::getAll

public CacheContextsManager::getAll() Provides an array of available cache contexts. Return value string[] An array of available cache context IDs. File core/lib/Drupal/Core/Cache/Context/CacheContextsManager.php, line 58 Class CacheContextsManager Converts cache context tokens into cache keys. Namespace Drupal\Core\Cache\Context Code public function getAll() { return $this->contexts; }

CacheContextsManager::assertValidTokens

public CacheContextsManager::assertValidTokens($context_tokens) Asserts the context tokens are valid Similar to ::validateTokens, this method returns boolean TRUE when the context tokens are valid, and FALSE when they are not instead of returning NULL when they are valid and throwing a \LogicException when they are not. This function should be used with the assert() statement. Parameters mixed $context_tokens: Variable to be examined - should be array of context_tokens. Return value bool TRUE

CacheContextsManager::$contexts

Available cache context IDs and corresponding labels. Type: string[] File core/lib/Drupal/Core/Cache/Context/CacheContextsManager.php, line 37 Class CacheContextsManager Converts cache context tokens into cache keys. Namespace Drupal\Core\Cache\Context Code protected $contexts;

CacheContextInterface::getContext

public CacheContextInterface::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. Return value string The string representation of the cache context. File core/lib/Drupal/Core/Cache/Context/CacheContextInterface.php, line 27 Class CacheContextInterface Provides an interface for defining a cache context service. Namespace Drupal\Core\C

CacheContextInterface::getLabel

public static CacheContextInterface::getLabel() Returns the label of the cache context. Return value string The label of the cache context. File core/lib/Drupal/Core/Cache/Context/CacheContextInterface.php, line 16 Class CacheContextInterface Provides an interface for defining a cache context service. Namespace Drupal\Core\Cache\Context Code public static function getLabel();

CacheContextInterface::getCacheableMetadata

public CacheContextInterface::getCacheableMetadata() Gets the cacheability metadata for the context. There are three valid cases for the returned CacheableMetadata object: An empty object means this can be optimized away safely. A max-age of 0 means that this context can never be optimized away. It will never bubble up and cache tags will not be used. Any non-zero max-age and cache tags will bubble up into the cache item if this is optimized away to allow for invalidation if the context value c

CacheContextsManager::$container

The service container. Type: \Symfony\Component\DependencyInjection\ContainerInterface File core/lib/Drupal/Core/Cache/Context/CacheContextsManager.php, line 30 Class CacheContextsManager Converts cache context tokens into cache keys. Namespace Drupal\Core\Cache\Context Code protected $container;

CacheContextsManager

Converts cache context tokens into cache keys. Uses cache context services (services tagged with 'cache.context', and whose service ID has the 'cache_context.' prefix) to dynamically generate cache keys based on the request context, thus allowing developers to express the state by which should varied (the current URL, language, and so on). Note that this maps exactly to HTTP's Vary header semantics: @link http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.44 Hierarchy class \Drupal\Co