You are here

protected function CacheableDependencyTrait::setCacheability in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Cache/CacheableDependencyTrait.php \Drupal\Core\Cache\CacheableDependencyTrait::setCacheability()
  2. 10 core/lib/Drupal/Core/Cache/CacheableDependencyTrait.php \Drupal\Core\Cache\CacheableDependencyTrait::setCacheability()

Sets cacheability; useful for value object constructors.

Parameters

\Drupal\Core\Cache\CacheableDependencyInterface $cacheability: The cacheability to set.

Return value

$this

19 calls to CacheableDependencyTrait::setCacheability()
CacheableAccessDeniedHttpException::__construct in core/lib/Drupal/Core/Http/Exception/CacheableAccessDeniedHttpException.php
Constructor.
CacheableBadRequestHttpException::__construct in core/lib/Drupal/Core/Http/Exception/CacheableBadRequestHttpException.php
Constructor.
CacheableConflictHttpException::__construct in core/lib/Drupal/Core/Http/Exception/CacheableConflictHttpException.php
Constructor.
CacheableGoneHttpException::__construct in core/lib/Drupal/Core/Http/Exception/CacheableGoneHttpException.php
Constructor.
CacheableHttpException::__construct in core/lib/Drupal/Core/Http/Exception/CacheableHttpException.php

... See full list

File

core/lib/Drupal/Core/Cache/CacheableDependencyTrait.php, line 39

Class

CacheableDependencyTrait
Trait for \Drupal\Core\Cache\CacheableDependencyInterface.

Namespace

Drupal\Core\Cache

Code

protected function setCacheability(CacheableDependencyInterface $cacheability) {
  $this->cacheContexts = $cacheability
    ->getCacheContexts();
  $this->cacheTags = $cacheability
    ->getCacheTags();
  $this->cacheMaxAge = $cacheability
    ->getCacheMaxAge();
  return $this;
}