function ContextAwarePluginTrait::getCacheTags
Same name in other branches
- 9 core/lib/Drupal/Core/Plugin/ContextAwarePluginTrait.php \Drupal\Core\Plugin\ContextAwarePluginTrait::getCacheTags()
- 10 core/lib/Drupal/Core/Plugin/ContextAwarePluginTrait.php \Drupal\Core\Plugin\ContextAwarePluginTrait::getCacheTags()
3 calls to ContextAwarePluginTrait::getCacheTags()
- ForumBlockBase::getCacheTags in core/
modules/ forum/ src/ Plugin/ Block/ ForumBlockBase.php - SystemBrandingBlock::getCacheTags in core/
modules/ system/ src/ Plugin/ Block/ SystemBrandingBlock.php - SystemMenuBlock::getCacheTags in core/
modules/ system/ src/ Plugin/ Block/ SystemMenuBlock.php
3 methods override ContextAwarePluginTrait::getCacheTags()
- ForumBlockBase::getCacheTags in core/
modules/ forum/ src/ Plugin/ Block/ ForumBlockBase.php - SystemBrandingBlock::getCacheTags in core/
modules/ system/ src/ Plugin/ Block/ SystemBrandingBlock.php - SystemMenuBlock::getCacheTags in core/
modules/ system/ src/ Plugin/ Block/ SystemMenuBlock.php
File
-
core/
lib/ Drupal/ Core/ Plugin/ ContextAwarePluginTrait.php, line 187
Class
- ContextAwarePluginTrait
- Provides a trait to add context-aware functionality to plugins.
Namespace
Drupal\Core\PluginCode
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 \Drupal\Core\Cache\CacheableDependencyInterface $context */
if ($context instanceof CacheableDependencyInterface) {
$tags = Cache::mergeTags($tags, $context->getCacheTags());
}
}
return $tags;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.