summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Pott2015-09-06 20:50:41 (GMT)
committerAlex Pott2015-09-06 20:50:41 (GMT)
commit45ce123503d6f4745074802856a5cc2b2238635f (patch)
treeb2b4b661a4224bde455ced57e2fdd650a2f1365d
parent62abde40b97ef79d8808a99fac4cd2e01845c6b5 (diff)
Issue #2551047 by Sweetchuck: Simplify the switch-case in system_tokens()
-rw-r--r--core/modules/system/system.tokens.inc14
1 files changed, 2 insertions, 12 deletions
diff --git a/core/modules/system/system.tokens.inc b/core/modules/system/system.tokens.inc
index 31b8030..a11f55d 100644
--- a/core/modules/system/system.tokens.inc
+++ b/core/modules/system/system.tokens.inc
@@ -165,21 +165,11 @@ function system_tokens($type, $tokens, array $data, array $options, BubbleableMe
foreach ($tokens as $name => $original) {
switch ($name) {
case 'short':
- $date_format = DateFormat::load('short');
- $bubbleable_metadata->addCacheableDependency($date_format);
- $replacements[$original] = format_date($date, 'short', '', NULL, $langcode);
- break;
-
case 'medium':
- $date_format = DateFormat::load('medium');
- $bubbleable_metadata->addCacheableDependency($date_format);
- $replacements[$original] = format_date($date, 'medium', '', NULL, $langcode);
- break;
-
case 'long':
- $date_format = DateFormat::load('long');
+ $date_format = DateFormat::load($name);
$bubbleable_metadata->addCacheableDependency($date_format);
- $replacements[$original] = format_date($date, 'long', '', NULL, $langcode);
+ $replacements[$original] = format_date($date, $name, '', NULL, $langcode);
break;
case 'since':