CacheableResponseTrait::getCacheableMetadata

public CacheableResponseTrait::getCacheableMetadata()

Returns the cacheability metadata for this response.

Return value

\Drupal\Core\Cache\CacheableMetadata

Overrides CacheableResponseInterface::getCacheableMetadata

File

core/lib/Drupal/Core/Cache/CacheableResponseTrait.php, line 37

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;
}
doc_Drupal
2016-10-29 08:49:15
Comments
Leave a Comment

Please login to continue.