function Context::addCacheableDependency

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Plugin/Context/Context.php \Drupal\Core\Plugin\Context\Context::addCacheableDependency()
  2. 10 core/lib/Drupal/Core/Plugin/Context/Context.php \Drupal\Core\Plugin\Context\Context::addCacheableDependency()
  3. 11.x core/lib/Drupal/Core/Plugin/Context/Context.php \Drupal\Core\Plugin\Context\Context::addCacheableDependency()

Overrides ContextInterface::addCacheableDependency

1 call to Context::addCacheableDependency()
Context::setContextValue in core/lib/Drupal/Core/Plugin/Context/Context.php
Sets the context value.

File

core/lib/Drupal/Core/Plugin/Context/Context.php, line 145

Class

Context
A Drupal specific context wrapper class.

Namespace

Drupal\Core\Plugin\Context

Code

public function addCacheableDependency($dependency) {
    $this->cacheabilityMetadata = $this->cacheabilityMetadata
        ->merge(CacheableMetadata::createFromObject($dependency));
    return $this;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.