You are here

public function ContextAwarePluginBase::getCacheTags in Drupal 8

The cache tags associated with this object.

When this object is modified, these cache tags will be invalidated.

Return value

string[] A set of cache tags.

Overrides CacheableDependencyInterface::getCacheTags

4 calls to ContextAwarePluginBase::getCacheTags()
AggregatorFeedBlock::getCacheTags in core/modules/aggregator/src/Plugin/Block/AggregatorFeedBlock.php
The cache tags associated with this object.
ForumBlockBase::getCacheTags in core/modules/forum/src/Plugin/Block/ForumBlockBase.php
The cache tags associated with this object.
SystemBrandingBlock::getCacheTags in core/modules/system/src/Plugin/Block/SystemBrandingBlock.php
The cache tags associated with this object.
SystemMenuBlock::getCacheTags in core/modules/system/src/Plugin/Block/SystemMenuBlock.php
The cache tags associated with this object.
4 methods override ContextAwarePluginBase::getCacheTags()
AggregatorFeedBlock::getCacheTags in core/modules/aggregator/src/Plugin/Block/AggregatorFeedBlock.php
The cache tags associated with this object.
ForumBlockBase::getCacheTags in core/modules/forum/src/Plugin/Block/ForumBlockBase.php
The cache tags associated with this object.
SystemBrandingBlock::getCacheTags in core/modules/system/src/Plugin/Block/SystemBrandingBlock.php
The cache tags associated with this object.
SystemMenuBlock::getCacheTags in core/modules/system/src/Plugin/Block/SystemMenuBlock.php
The cache tags associated with this object.

File

core/lib/Drupal/Core/Plugin/ContextAwarePluginBase.php, line 146

Class

ContextAwarePluginBase
Base class for plugins that are context aware.

Namespace

Drupal\Core\Plugin

Code

public function getCacheTags() {
  $tags = [];

  // Applied contexts can affect the cache tags when this plugin is
  // involved in caching, collect and return them.
  foreach ($this
    ->getContexts() as $context) {

    /** @var $context \Drupal\Core\Cache\CacheableDependencyInterface */
    if ($context instanceof CacheableDependencyInterface) {
      $tags = Cache::mergeTags($tags, $context
        ->getCacheTags());
    }
  }
  return $tags;
}