diff --git a/core/modules/system/system.tokens.inc b/core/modules/system/system.tokens.inc index 562be7ac0a..7d10ebbcc7 100644 --- a/core/modules/system/system.tokens.inc +++ b/core/modules/system/system.tokens.inc @@ -7,7 +7,6 @@ * This file handles tokens for the global 'site' and 'date' tokens. */ -use Drupal\Core\Datetime\Entity\DateFormat; use Drupal\Core\Render\BubbleableMetadata; /** @@ -71,9 +70,9 @@ function system_token_info() { foreach ($date_formats as $date_format) { $date[$date_format->id()] = [ 'name' => $date_format->label(), - 'description' => t("A date in the %name format. (%date)", [ + 'description' => t('A date in the %name format. (%date)', [ '%name' => $date_format->label(), - '%date' => $date_formatter->format(REQUEST_TIME, $date_format->id()), + '%date' => $date_formatter->format(\Drupal::time()->getRequestTime(), $date_format->id()), ]), ]; } diff --git a/core/modules/system/tests/src/Kernel/Token/TokenReplaceKernelTest.php b/core/modules/system/tests/src/Kernel/Token/TokenReplaceKernelTest.php index fb60e103e6..d820bcfa6c 100644 --- a/core/modules/system/tests/src/Kernel/Token/TokenReplaceKernelTest.php +++ b/core/modules/system/tests/src/Kernel/Token/TokenReplaceKernelTest.php @@ -171,7 +171,7 @@ public function testSystemDateTokenGetInfo() { $tokens = \Drupal::token()->getInfo(); $this->assertArrayNotHasKey('y2k', $tokens['tokens']['date']); - // Add new tokens. + // Add new formats. $date_format = DateFormat::create([ 'id' => 'y2k', 'label' => 'Y2K', @@ -182,7 +182,7 @@ public function testSystemDateTokenGetInfo() { $tokens = \Drupal::token()->getInfo(); $this->assertArrayHasKey('y2k', $tokens['tokens']['date']); - // Delete new token. + // Delete the new format. DateFormat::load('y2k')->delete(); // Get the count of removed tokens.