Issue #2551047 by Sweetchuck: Simplify the switch-case in system_tokens()

8.0.x
Alex Pott 2015-09-06 21:50:41 +01:00
parent 62abde40b9
commit 45ce123503
1 changed files with 2 additions and 12 deletions

View File

@ -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':