Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. RefinableCacheableDependencyTrait.php

function RefinableCacheableDependencyTrait::addCacheContexts

4 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.
HelpSearch::findResults in core/modules/help/src/Plugin/Search/HelpSearch.php
Finds the search results.
RefinableCacheableDependencyTrait::addCacheableDependency in core/lib/Drupal/Core/Cache/RefinableCacheableDependencyTrait.php

File

core/lib/Drupal/Core/Cache/RefinableCacheableDependencyTrait.php, line 31

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;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal