protected function CacheableSecuredRedirectResponse::fromResponse

protected CacheableSecuredRedirectResponse::fromResponse(RedirectResponse $response)

Copies over the values from the given response.

Parameters

\Symfony\Component\HttpFoundation\RedirectResponse $response: The redirect reponse object.

Overrides SecuredRedirectResponse::fromResponse

File

core/lib/Drupal/Core/Routing/CacheableSecuredRedirectResponse.php, line 20

Class

CacheableSecuredRedirectResponse
Provides a common base class for cacheable safe redirects.

Namespace

Drupal\Core\Routing

Code

protected function fromResponse(RedirectResponse $response) {
  parent::fromResponse($response);

  $metadata = $this->getCacheableMetadata();
  if ($response instanceof CacheableResponseInterface) {
    $metadata->addCacheableDependency($response->getCacheableMetadata());
  }
  else {
    $metadata->setCacheMaxAge(0);
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Routing!CacheableSecuredRedirectResponse.php/function/CacheableSecuredRedirectResponse::fromResponse/8.1.x