class CacheableSecuredRedirectResponse

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Routing/CacheableSecuredRedirectResponse.php \Drupal\Core\Routing\CacheableSecuredRedirectResponse
  2. 8.9.x core/lib/Drupal/Core/Routing/CacheableSecuredRedirectResponse.php \Drupal\Core\Routing\CacheableSecuredRedirectResponse
  3. 10 core/lib/Drupal/Core/Routing/CacheableSecuredRedirectResponse.php \Drupal\Core\Routing\CacheableSecuredRedirectResponse

Provides a common base class for cacheable safe redirects.

Hierarchy

Expanded class hierarchy of CacheableSecuredRedirectResponse

File

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

Namespace

Drupal\Core\Routing
View source
abstract class CacheableSecuredRedirectResponse extends SecuredRedirectResponse implements CacheableResponseInterface {
    use CacheableResponseTrait;
    
    /**
     * {@inheritdoc}
     */
    protected function fromResponse(RedirectResponse $response) {
        parent::fromResponse($response);
        $metadata = $this->getCacheableMetadata();
        if ($response instanceof CacheableResponseInterface) {
            $metadata->addCacheableDependency($response->getCacheableMetadata());
        }
        else {
            $metadata->setCacheMaxAge(0);
        }
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
CacheableResponseTrait::$cacheabilityMetadata protected property The cacheability metadata.
CacheableResponseTrait::addCacheableDependency public function
CacheableResponseTrait::getCacheableMetadata public function
CacheableSecuredRedirectResponse::fromResponse protected function Copies over the values from the given response. Overrides SecuredRedirectResponse::fromResponse
SecuredRedirectResponse::createFromRedirectResponse public static function Copies an existing redirect response into a safe one.
SecuredRedirectResponse::isSafe abstract protected function Returns whether the URL is considered as safe to redirect to. 2
SecuredRedirectResponse::setTargetUrl public function

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