class RequestFormatCacheContext in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Cache/Context/RequestFormatCacheContext.php \Drupal\Core\Cache\Context\RequestFormatCacheContext
- 9 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
Expanded class hierarchy of RequestFormatCacheContext
1 string reference to 'RequestFormatCacheContext'
- core.services.yml in core/
core.services.yml - core/core.services.yml
1 service uses 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
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
RequestFormatCacheContext:: |
public | function | ||
RequestFormatCacheContext:: |
public | function | ||
RequestFormatCacheContext:: |
public static | function | ||
RequestStackCacheContextBase:: |
protected | property | The request stack. | |
RequestStackCacheContextBase:: |
public | function | Constructs a new RequestStackCacheContextBase class. |