class DenyPrivateImageStyleDownload in Drupal 9
Same name and namespace in other branches
- 8 core/modules/image/src/PageCache/DenyPrivateImageStyleDownload.php \Drupal\image\PageCache\DenyPrivateImageStyleDownload
- 10 core/modules/image/src/PageCache/DenyPrivateImageStyleDownload.php \Drupal\image\PageCache\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 ResponsePolicyInterface
Expanded class hierarchy of DenyPrivateImageStyleDownload
1 file declares its use of DenyPrivateImageStyleDownload
- DenyPrivateImageStyleDownloadTest.php in core/
modules/ image/ tests/ src/ Unit/ PageCache/ DenyPrivateImageStyleDownloadTest.php
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
File
- core/
modules/ image/ src/ PageCache/ DenyPrivateImageStyleDownload.php, line 16
Namespace
Drupal\image\PageCacheView 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
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DenyPrivateImageStyleDownload:: |
protected | property | The current route match. | |
DenyPrivateImageStyleDownload:: |
public | function |
Determines whether it is save to store a page in the cache. Overrides ResponsePolicyInterface:: |
|
DenyPrivateImageStyleDownload:: |
public | function | Constructs a deny image preview page cache policy. | |
ResponsePolicyInterface:: |
constant | Deny storage of a page in the cache. |