You are here

class RequestFormatCacheContext in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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

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
cache_context.request_format in core/core.services.yml
Drupal\Core\Cache\Context\RequestFormatCacheContext

File

core/lib/Drupal/Core/Cache/Context/RequestFormatCacheContext.php, line 17
Contains \Drupal\Core\Cache\Context\RequestFormatCacheContext.

Namespace

Drupal\Core\Cache\Context
View 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

Namesort descending Modifiers Type Description Overrides
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.