class RequestFormatCacheContext
Same name in other branches
- 9 core/lib/Drupal/Core/Cache/Context/RequestFormatCacheContext.php \Drupal\Core\Cache\Context\RequestFormatCacheContext
- 8.9.x core/lib/Drupal/Core/Cache/Context/RequestFormatCacheContext.php \Drupal\Core\Cache\Context\RequestFormatCacheContext
- 10 core/lib/Drupal/Core/Cache/Context/RequestFormatCacheContext.php \Drupal\Core\Cache\Context\RequestFormatCacheContext
Defines the RequestFormatCacheContext service, for "per format" caching.
Cache context ID: 'request_format'.
Hierarchy
- class \Drupal\Core\Cache\Context\RequestStackCacheContextBase
- class \Drupal\Core\Cache\Context\RequestFormatCacheContext extends \Drupal\Core\Cache\Context\RequestStackCacheContextBase
Expanded class hierarchy of RequestFormatCacheContext
File
-
core/
lib/ Drupal/ Core/ Cache/ Context/ RequestFormatCacheContext.php, line 12
Namespace
Drupal\Core\Cache\ContextView source
class RequestFormatCacheContext extends RequestStackCacheContextBase {
/**
* {@inheritdoc}
*/
public static function getLabel() {
return t('Request format');
}
/**
* {@inheritdoc}
*/
public function getContext() {
return $this->requestStack
->getCurrentRequest()
->getRequestFormat();
}
/**
* {@inheritdoc}
*/
public function getCacheableMetadata() {
return new CacheableMetadata();
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
RequestFormatCacheContext::getCacheableMetadata | public | function | |
RequestFormatCacheContext::getContext | public | function | |
RequestFormatCacheContext::getLabel | public static | function | |
RequestStackCacheContextBase::$requestStack | protected | property | The request stack. |
RequestStackCacheContextBase::__construct | public | function | Constructs a new RequestStackCacheContextBase class. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.