You are here

public function DenyPrivateImageStyleDownload::check in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/image/src/PageCache/DenyPrivateImageStyleDownload.php \Drupal\image\PageCache\DenyPrivateImageStyleDownload::check()
  2. 10 core/modules/image/src/PageCache/DenyPrivateImageStyleDownload.php \Drupal\image\PageCache\DenyPrivateImageStyleDownload::check()

Determines whether it is save to store a page in the cache.

Parameters

\Symfony\Component\HttpFoundation\Response $response: The response which is about to be sent to the client.

\Symfony\Component\HttpFoundation\Request $request: The request object.

Return value

string|null Either static::DENY or NULL. Calling code may attempt to store a page in the cache unless static::DENY is returned. Returns NULL if the policy policy is not specified for the given response.

Overrides ResponsePolicyInterface::check

File

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

Class

DenyPrivateImageStyleDownload
Cache policy for image preview page.

Namespace

Drupal\image\PageCache

Code

public function check(Response $response, Request $request) {
  if ($this->routeMatch
    ->getRouteName() === 'image.style_private') {
    return static::DENY;
  }
}