You are here

public function CacheableResponseTrait::getCacheableMetadata in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Cache/CacheableResponseTrait.php \Drupal\Core\Cache\CacheableResponseTrait::getCacheableMetadata()
1 call to CacheableResponseTrait::getCacheableMetadata()
CacheableSecuredRedirectResponse::fromResponse in core/lib/Drupal/Core/Routing/CacheableSecuredRedirectResponse.php
Copies over the values from the given response.

File

core/lib/Drupal/Core/Cache/CacheableResponseTrait.php, line 42
Contains \Drupal\Core\Cache\CacheableResponseTrait.

Class

CacheableResponseTrait
Provides an implementation of CacheableResponseInterface.

Namespace

Drupal\Core\Cache

Code

public function getCacheableMetadata() {

  // A trait doesn't have a constructor, so initialize the cacheability
  // metadata if that hasn't happened yet.
  if (!isset($this->cacheabilityMetadata)) {
    $this->cacheabilityMetadata = new CacheableMetadata();
  }
  return $this->cacheabilityMetadata;
}