8.3.x RefinableCacheableDependencyTrait.php public RefinableCacheableDependencyTrait::addCacheTags(array $cache_tags)
8.0.x RefinableCacheableDependencyTrait.php public RefinableCacheableDependencyTrait::addCacheTags(array $cache_tags)
8.1.x RefinableCacheableDependencyTrait.php public RefinableCacheableDependencyTrait::addCacheTags(array $cache_tags)
8.2.x RefinableCacheableDependencyTrait.php public RefinableCacheableDependencyTrait::addCacheTags(array $cache_tags)
8.4.x RefinableCacheableDependencyTrait.php public RefinableCacheableDependencyTrait::addCacheTags(array $cache_tags)

Adds cache tags.

Parameters

string[] $cache_tags: The cache tags to be added.

Return value

$this

Overrides RefinableCacheableDependencyInterface::addCacheTags

3 calls to RefinableCacheableDependencyTrait::addCacheTags()
NodeSearch::__construct in core/modules/node/src/Plugin/Search/NodeSearch.php
Constructs a \Drupal\node\Plugin\Search\NodeSearch object.
RefinableCacheableDependencyTrait::addCacheableDependency in core/lib/Drupal/Core/Cache/RefinableCacheableDependencyTrait.php
Adds a dependency on an object: merges its cacheability metadata.
UserSearch::__construct in core/modules/user/src/Plugin/Search/UserSearch.php
Creates a UserSearch object.

File

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

Class

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

Namespace

Drupal\Core\Cache

Code

public function addCacheTags(array $cache_tags) {
  if ($cache_tags) {
    $this->cacheTags = Cache::mergeTags($this->cacheTags, $cache_tags);
  }
  return $this;
}