You are here

public function RefinableCacheableDependencyTrait::addCacheContexts in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Cache/RefinableCacheableDependencyTrait.php \Drupal\Core\Cache\RefinableCacheableDependencyTrait::addCacheContexts()
3 calls to RefinableCacheableDependencyTrait::addCacheContexts()
AccessResult::cachePerPermissions in core/lib/Drupal/Core/Access/AccessResult.php
Convenience method, adds the "user.permissions" cache context.
AccessResult::cachePerUser in core/lib/Drupal/Core/Access/AccessResult.php
Convenience method, adds the "user" cache context.
RefinableCacheableDependencyTrait::addCacheableDependency in core/lib/Drupal/Core/Cache/RefinableCacheableDependencyTrait.php

File

core/lib/Drupal/Core/Cache/RefinableCacheableDependencyTrait.php, line 76
Contains \Drupal\Core\Cache\RefinableCacheableDependencyTrait.

Class

RefinableCacheableDependencyTrait
Trait for \Drupal\Core\Cache\RefinableCacheableDependencyInterface.

Namespace

Drupal\Core\Cache

Code

public function addCacheContexts(array $cache_contexts) {
  if ($cache_contexts) {
    $this->cacheContexts = Cache::mergeContexts($this->cacheContexts, $cache_contexts);
  }
  return $this;
}