function SecuredRedirectResponse::fromResponse

Same name in other branches
  1. 9 core/lib/Drupal/Component/HttpFoundation/SecuredRedirectResponse.php \Drupal\Component\HttpFoundation\SecuredRedirectResponse::fromResponse()
  2. 10 core/lib/Drupal/Component/HttpFoundation/SecuredRedirectResponse.php \Drupal\Component\HttpFoundation\SecuredRedirectResponse::fromResponse()
  3. 11.x core/lib/Drupal/Component/HttpFoundation/SecuredRedirectResponse.php \Drupal\Component\HttpFoundation\SecuredRedirectResponse::fromResponse()

Copies over the values from the given response.

Parameters

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

1 call to SecuredRedirectResponse::fromResponse()
CacheableSecuredRedirectResponse::fromResponse in core/lib/Drupal/Core/Routing/CacheableSecuredRedirectResponse.php
Copies over the values from the given response.
1 method overrides SecuredRedirectResponse::fromResponse()
CacheableSecuredRedirectResponse::fromResponse in core/lib/Drupal/Core/Routing/CacheableSecuredRedirectResponse.php
Copies over the values from the given response.

File

core/lib/Drupal/Component/HttpFoundation/SecuredRedirectResponse.php, line 41

Class

SecuredRedirectResponse
Provides a common base class for safe redirects.

Namespace

Drupal\Component\HttpFoundation

Code

protected function fromResponse(RedirectResponse $response) {
    $this->setProtocolVersion($response->getProtocolVersion());
    if ($response->getCharset()) {
        $this->setCharset($response->getCharset());
    }
    // Cookies are separate from other headers and have to be copied over
    // directly.
    foreach ($response->headers
        ->getCookies() as $cookie) {
        $this->headers
            ->setCookie($cookie);
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.