core/core.services.yml | 8 ++++---- .../Core/Field/Plugin/Field/FieldFormatter/TimestampFormatter.php | 2 +- .../src/Plugin/Field/FieldFormatter/DateTimeDefaultFormatter.php | 2 +- .../src/Plugin/Field/FieldFormatter/DateTimePlainFormatter.php | 2 +- core/modules/node/src/Tests/NodeCacheTagsTest.php | 2 +- core/modules/node/src/Tests/Views/FrontPageTest.php | 2 +- .../system/src/Tests/Cache/PageCacheTagsIntegrationTest.php | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/core/core.services.yml b/core/core.services.yml index bc27295..6c209ce 100644 --- a/core/core.services.yml +++ b/core/core.services.yml @@ -84,10 +84,6 @@ services: arguments: ['@current_user'] tags: - { name: cache.context} - cache_context.user.timezone: - class: Drupal\Core\Cache\TimeZoneCacheContext - tags: - - { name: cache.context} cache_context.languages: class: Drupal\Core\Cache\LanguagesCacheContext arguments: ['@language_manager'] @@ -98,6 +94,10 @@ services: arguments: ['@theme.manager'] tags: - { name: cache.context} + cache_context.timezone: + class: Drupal\Core\Cache\TimeZoneCacheContext + tags: + - { name: cache.context} cache_factory: class: Drupal\Core\Cache\CacheFactory diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/TimestampFormatter.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/TimestampFormatter.php index 13fe51b..cb28315 100644 --- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/TimestampFormatter.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/TimestampFormatter.php @@ -35,7 +35,7 @@ public function viewElements(FieldItemListInterface $items) { $elements[$delta] = [ '#cache' => [ 'contexts' => [ - 'user.timezone', + 'timezone', ], ], '#markup' => format_date($item->value) diff --git a/core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeDefaultFormatter.php b/core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeDefaultFormatter.php index 6634592..a7cb32a 100644 --- a/core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeDefaultFormatter.php +++ b/core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeDefaultFormatter.php @@ -129,7 +129,7 @@ public function viewElements(FieldItemListInterface $items) { $elements[$delta] = array( '#cache' => [ 'contexts' => [ - 'user.timezone', + 'timezone', ], ], '#theme' => 'time', diff --git a/core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimePlainFormatter.php b/core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimePlainFormatter.php index f0c0872..3f68a7f 100644 --- a/core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimePlainFormatter.php +++ b/core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimePlainFormatter.php @@ -49,7 +49,7 @@ public function viewElements(FieldItemListInterface $items) { $elements[$delta] = [ '#cache' => [ 'contexts' => [ - 'user.timezone', + 'timezone', ], ], '#markup' => $output, diff --git a/core/modules/node/src/Tests/NodeCacheTagsTest.php b/core/modules/node/src/Tests/NodeCacheTagsTest.php index 05d9b62..8144ba2 100644 --- a/core/modules/node/src/Tests/NodeCacheTagsTest.php +++ b/core/modules/node/src/Tests/NodeCacheTagsTest.php @@ -46,7 +46,7 @@ protected function createEntity() { * {@inheritdoc} */ protected function getAdditionalCacheContextsForEntity(EntityInterface $entity) { - return ['user.timezone']; + return ['timezone']; } /** diff --git a/core/modules/node/src/Tests/Views/FrontPageTest.php b/core/modules/node/src/Tests/Views/FrontPageTest.php index fede08f..ed6fd3d 100644 --- a/core/modules/node/src/Tests/Views/FrontPageTest.php +++ b/core/modules/node/src/Tests/Views/FrontPageTest.php @@ -281,7 +281,7 @@ protected function assertFrontPageViewCacheTags($do_assert_views_caches) { } $cache_contexts = Cache::mergeContexts($cache_contexts, [ 'theme', - 'user.timezone', + 'timezone', 'user.roles' ]); diff --git a/core/modules/system/src/Tests/Cache/PageCacheTagsIntegrationTest.php b/core/modules/system/src/Tests/Cache/PageCacheTagsIntegrationTest.php index 34268c0..efbc1ad 100644 --- a/core/modules/system/src/Tests/Cache/PageCacheTagsIntegrationTest.php +++ b/core/modules/system/src/Tests/Cache/PageCacheTagsIntegrationTest.php @@ -74,7 +74,7 @@ function testPageCacheTags() { 'url.route.menu_active_trails:main', 'url.route.menu_active_trails:tools', 'theme', - 'user.timezone', + 'timezone', 'user.roles', ];