You are here

public function DenyAdminRoutes::check in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/dynamic_page_cache/src/PageCache/ResponsePolicy/DenyAdminRoutes.php \Drupal\dynamic_page_cache\PageCache\ResponsePolicy\DenyAdminRoutes::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/dynamic_page_cache/src/PageCache/ResponsePolicy/DenyAdminRoutes.php, line 44
Contains \Drupal\dynamic_page_cache\PageCache\ResponsePolicy\DenyAdminRoutes.

Class

DenyAdminRoutes
Cache policy for routes with the '_admin_route' option set.

Namespace

Drupal\dynamic_page_cache\PageCache\ResponsePolicy

Code

public function check(Response $response, Request $request) {
  if (($route = $this->routeMatch
    ->getRouteObject()) && $route
    ->getOption('_admin_route')) {
    return static::DENY;
  }
}