diff --git a/core/modules/language/src/Plugin/Block/LanguageBlock.php b/core/modules/language/src/Plugin/Block/LanguageBlock.php index 8e7ee918d5..5a998039ed 100644 --- a/core/modules/language/src/Plugin/Block/LanguageBlock.php +++ b/core/modules/language/src/Plugin/Block/LanguageBlock.php @@ -101,16 +101,11 @@ public function build() { '#set_active_class' => TRUE, ]; } + + // Add cache contexts for things that might cause links to change. + $build['#cache']['contexts'] = ['user.permissions', 'url.path', 'url.query_args', 'languages:' . $this->getDerivativeId()]; + return $build; } - /** - * {@inheritdoc} - * - * @todo Make cacheable in https://www.drupal.org/node/2232375. - */ - public function getCacheMaxAge() { - return 0; - } - }