Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. DenyPrivateImageStyleDownload.php

class DenyPrivateImageStyleDownload

Cache policy for image preview page.

This policy rule denies caching of responses generated by the entity.image.preview route.

Hierarchy

  • class \Drupal\image\PageCache\DenyPrivateImageStyleDownload implements \Drupal\Core\PageCache\ResponsePolicyInterface

Expanded class hierarchy of DenyPrivateImageStyleDownload

1 string reference to 'DenyPrivateImageStyleDownload'
image.services.yml in core/modules/image/image.services.yml
core/modules/image/image.services.yml
1 service uses DenyPrivateImageStyleDownload
image.page_cache_response_policy.deny_private_image_style_download in core/modules/image/image.services.yml
Drupal\image\PageCache\DenyPrivateImageStyleDownload

File

core/modules/image/src/PageCache/DenyPrivateImageStyleDownload.php, line 16

Namespace

Drupal\image\PageCache
View source
class DenyPrivateImageStyleDownload implements ResponsePolicyInterface {
    
    /**
     * The current route match.
     *
     * @var \Drupal\Core\Routing\RouteMatchInterface
     */
    protected $routeMatch;
    
    /**
     * Constructs a deny image preview page cache policy.
     *
     * @param \Drupal\Core\Routing\RouteMatchInterface $route_match
     *   The current route match.
     */
    public function __construct(RouteMatchInterface $route_match) {
        $this->routeMatch = $route_match;
    }
    
    /**
     * {@inheritdoc}
     */
    public function check(Response $response, Request $request) {
        if ($this->routeMatch
            ->getRouteName() === 'image.style_private') {
            return static::DENY;
        }
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
DenyPrivateImageStyleDownload::$routeMatch protected property The current route match.
DenyPrivateImageStyleDownload::check public function Determines whether it is save to store a page in the cache. Overrides ResponsePolicyInterface::check
DenyPrivateImageStyleDownload::__construct public function Constructs a deny image preview page cache policy.
ResponsePolicyInterface::DENY constant Deny storage of a page in the cache.

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal