diff --git a/core/lib/Drupal/Core/Block/BlockBase.php b/core/lib/Drupal/Core/Block/BlockBase.php index 5af5efa..fa65e53 100644 --- a/core/lib/Drupal/Core/Block/BlockBase.php +++ b/core/lib/Drupal/Core/Block/BlockBase.php @@ -10,6 +10,7 @@ use Drupal\block\BlockInterface; use Drupal\Component\Utility\SafeMarkup; use Drupal\Core\Access\AccessResult; +use Drupal\Core\Cache\CacheableDependencyInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Plugin\ContextAwarePluginAssignmentTrait; use Drupal\Core\Plugin\ContextAwarePluginBase; @@ -322,7 +323,13 @@ public function getCacheContexts() { * {@inheritdoc} */ public function getCacheTags() { - return []; + $cache_tags = []; + foreach ($this->getContextValues() as $key => $context) { + if ($context instanceof CacheableDependencyInterface) { + Cache::mergeTags($cache_tags, $context->getCacheTags()); + } + } + return $cache_tags; } /** diff --git a/core/modules/aggregator/src/Plugin/Block/AggregatorFeedBlock.php b/core/modules/aggregator/src/Plugin/Block/AggregatorFeedBlock.php index 7e178b4..38db125 100644 --- a/core/modules/aggregator/src/Plugin/Block/AggregatorFeedBlock.php +++ b/core/modules/aggregator/src/Plugin/Block/AggregatorFeedBlock.php @@ -163,13 +163,4 @@ public function build() { } } - /** - * {@inheritdoc} - */ - public function getCacheTags() { - $cache_tags = parent::getCacheTags(); - $feed = $this->getContextValue('feed'); - return Cache::mergeTags($cache_tags, $feed->getCacheTags()); - } - }