8.5.x ContextAwarePluginBase.php ContextAwarePluginBase::getCacheTags()
8.0.x ContextAwarePluginBase.php ContextAwarePluginBase::getCacheTags()
8.1.x ContextAwarePluginBase.php ContextAwarePluginBase::getCacheTags()
8.2.x ContextAwarePluginBase.php ContextAwarePluginBase::getCacheTags()
8.3.x ContextAwarePluginBase.php ContextAwarePluginBase::getCacheTags()
8.4.x ContextAwarePluginBase.php ContextAwarePluginBase::getCacheTags()
8.6.x ContextAwarePluginBase.php ContextAwarePluginBase::getCacheTags()

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