function CacheableDependencyTrait::setCacheability
Same name and namespace in other branches
- 11.x core/lib/Drupal/Core/Cache/CacheableDependencyTrait.php \Drupal\Core\Cache\CacheableDependencyTrait::setCacheability()
- 10 core/lib/Drupal/Core/Cache/CacheableDependencyTrait.php \Drupal\Core\Cache\CacheableDependencyTrait::setCacheability()
- 8.9.x 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
5 calls to CacheableDependencyTrait::setCacheability()
- CacheableGoneHttpException::__construct in core/
lib/ Drupal/ Core/ Http/ Exception/ CacheableGoneHttpException.php - CacheableNormalization::__construct in core/
modules/ jsonapi/ src/ Normalizer/ Value/ CacheableNormalization.php - CacheableNormalization constructor.
- CacheablePreconditionRequiredHttpException::__construct in core/
lib/ Drupal/ Core/ Http/ Exception/ CacheablePreconditionRequiredHttpException.php - Link::__construct in core/
modules/ jsonapi/ src/ JsonApiResource/ Link.php - JSON:API Link constructor.
- ResourceObject::__construct in core/
modules/ jsonapi/ src/ JsonApiResource/ ResourceObject.php - ResourceObject constructor.
File
-
core/
lib/ Drupal/ Core/ Cache/ CacheableDependencyTrait.php, line 39
Class
Namespace
Drupal\Core\CacheCode
protected function setCacheability(CacheableDependencyInterface $cacheability) {
$this->cacheContexts = $cacheability->getCacheContexts();
$this->cacheTags = $cacheability->getCacheTags();
$this->cacheMaxAge = $cacheability->getCacheMaxAge();
return $this;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.