class DenyNodePreview in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/node/src/PageCache/DenyNodePreview.php \Drupal\node\PageCache\DenyNodePreview
Cache policy for node preview page.
This policy rule denies caching of responses generated by the entity.node.preview route.
Hierarchy
- class \Drupal\node\PageCache\DenyNodePreview implements ResponsePolicyInterface
Expanded class hierarchy of DenyNodePreview
1 file declares its use of DenyNodePreview
- DenyNodePreviewTest.php in core/
modules/ node/ tests/ src/ Unit/ PageCache/ DenyNodePreviewTest.php - Contains \Drupal\Tests\node\Unit\PageCache\DenyNodePreviewTest.
1 string reference to 'DenyNodePreview'
- node.services.yml in core/
modules/ node/ node.services.yml - core/modules/node/node.services.yml
1 service uses DenyNodePreview
File
- core/
modules/ node/ src/ PageCache/ DenyNodePreview.php, line 21 - Contains \Drupal\node\PageCache\DenyNodePreview.
Namespace
Drupal\node\PageCacheView source
class DenyNodePreview implements ResponsePolicyInterface {
/**
* The current route match.
*
* @var \Drupal\Core\Routing\RouteMatchInterface
*/
protected $routeMatch;
/**
* Constructs a deny node 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() === 'entity.node.preview') {
return static::DENY;
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DenyNodePreview:: |
protected | property | The current route match. | |
DenyNodePreview:: |
public | function |
Determines whether it is save to store a page in the cache. Overrides ResponsePolicyInterface:: |
|
DenyNodePreview:: |
public | function | Constructs a deny node preview page cache policy. | |
ResponsePolicyInterface:: |
constant | Deny storage of a page in the cache. |