RequestFormatCacheContext.php in Drupal 10
File
core/lib/Drupal/Core/Cache/Context/RequestFormatCacheContext.php
View source
<?php
namespace Drupal\Core\Cache\Context;
use Drupal\Core\Cache\CacheableMetadata;
class RequestFormatCacheContext extends RequestStackCacheContextBase {
public static function getLabel() {
return t('Request format');
}
public function getContext() {
return $this->requestStack
->getCurrentRequest()
->getRequestFormat();
}
public function getCacheableMetadata() {
return new CacheableMetadata();
}
}