diff --git a/core/lib/Drupal/Core/Block/BlockBase.php b/core/lib/Drupal/Core/Block/BlockBase.php index fa65e53..e593ad4 100644 --- a/core/lib/Drupal/Core/Block/BlockBase.php +++ b/core/lib/Drupal/Core/Block/BlockBase.php @@ -316,7 +316,13 @@ public function setTransliteration(TransliterationInterface $transliteration) { * {@inheritdoc} */ public function getCacheContexts() { - return []; + $cache_contexts = []; + foreach ($this->getContextValues() as $key => $context) { + if ($context instanceof CacheableDependencyInterface) { + Cache::mergeContexts($cache_contexts, $context->getCacheContexts()); + } + } + return $cache_contexts; } /** @@ -336,7 +342,13 @@ public function getCacheTags() { * {@inheritdoc} */ public function getCacheMaxAge() { - return (int)$this->configuration['cache']['max_age']; + $max_age = (int)$this->configuration['cache']['max_age']; + foreach ($this->getContextValues() as $key => $context) { + if ($context instanceof CacheableDependencyInterface) { + Cache::mergeMaxAges($max_age, $context->getCacheMaxAge()); + } + } + return $max_age; } } diff --git a/core/lib/Drupal/Core/Plugin/ContextAwarePluginAssignmentTrait.php b/core/lib/Drupal/Core/Plugin/ContextAwarePluginAssignmentTrait.php index cc5e092..d7f6de2 100644 --- a/core/lib/Drupal/Core/Plugin/ContextAwarePluginAssignmentTrait.php +++ b/core/lib/Drupal/Core/Plugin/ContextAwarePluginAssignmentTrait.php @@ -60,7 +60,7 @@ protected function addContextAssignmentElement(ContextAwarePluginInterface $plug if (count($options) > 1) { // The context display element is only useful when a single context is - // avaialable, we have multiple and require user interaction. + // available, we have multiple and require user interaction. unset($element['context_slot_title']); $assignments = $plugin->getContextMapping(); diff --git a/core/modules/aggregator/config/schema/aggregator.schema.yml b/core/modules/aggregator/config/schema/aggregator.schema.yml index c835f15..cb2837c 100644 --- a/core/modules/aggregator/config/schema/aggregator.schema.yml +++ b/core/modules/aggregator/config/schema/aggregator.schema.yml @@ -48,7 +48,7 @@ block.settings.aggregator_feed_block: type: mapping label: 'Context assignments' mapping: - #This will be stored in the format of aggregator.feed:$uuid + # This will be stored in the format of 'aggregator.feed:$uuid'. feed: type: string label: 'Feed' diff --git a/core/modules/block/src/EventSubscriber/NodeRouteContext.php b/core/modules/block/src/EventSubscriber/NodeRouteContext.php index cbb7fc7..ddbf846 100644 --- a/core/modules/block/src/EventSubscriber/NodeRouteContext.php +++ b/core/modules/block/src/EventSubscriber/NodeRouteContext.php @@ -61,7 +61,7 @@ public function onBlockActiveContext(BlockContextEvent $event) { * {@inheritdoc} */ public function onBlockAdministrativeContext(BlockContextEvent $event) { - $context = new Context(new ContextDefinition('entity:node', $this->t('Node from url'))); + $context = new Context(new ContextDefinition('entity:node', $this->t('Node from URL'))); $event->setContext('node.node', $context); }