RequestStackCacheContextBase.php

Same filename in other branches
  1. 9 core/lib/Drupal/Core/Cache/Context/RequestStackCacheContextBase.php
  2. 8.9.x core/lib/Drupal/Core/Cache/Context/RequestStackCacheContextBase.php
  3. 11.x core/lib/Drupal/Core/Cache/Context/RequestStackCacheContextBase.php

Namespace

Drupal\Core\Cache\Context

File

core/lib/Drupal/Core/Cache/Context/RequestStackCacheContextBase.php

View source
<?php

namespace Drupal\Core\Cache\Context;

use Symfony\Component\HttpFoundation\RequestStack;

/**
 * Defines a base class for cache contexts depending only on the request stack.
 *
 * Subclasses need to implement either
 * \Drupal\Core\Cache\Context\CacheContextInterface or
 * \Drupal\Core\Cache\Context\CalculatedCacheContextInterface.
 */
abstract class RequestStackCacheContextBase {
    
    /**
     * The request stack.
     *
     * @var \Symfony\Component\HttpFoundation\RequestStack
     */
    protected $requestStack;
    
    /**
     * Constructs a new RequestStackCacheContextBase class.
     *
     * @param \Symfony\Component\HttpFoundation\RequestStack $request_stack
     *   The request stack.
     */
    public function __construct(RequestStack $request_stack) {
        $this->requestStack = $request_stack;
    }

}

Classes

Title Deprecated Summary
RequestStackCacheContextBase Defines a base class for cache contexts depending only on the request stack.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.