Update core 8.3.0
This commit is contained in:
parent
da7a7918f8
commit
cd7a898e66
6144 changed files with 132297 additions and 87747 deletions
|
@ -14,74 +14,74 @@ use Drupal\Core\Render\BubbleableMetadata;
|
|||
* Implements hook_token_info().
|
||||
*/
|
||||
function system_token_info() {
|
||||
$types['site'] = array(
|
||||
$types['site'] = [
|
||||
'name' => t("Site information"),
|
||||
'description' => t("Tokens for site-wide settings and other global information."),
|
||||
);
|
||||
$types['date'] = array(
|
||||
];
|
||||
$types['date'] = [
|
||||
'name' => t("Dates"),
|
||||
'description' => t("Tokens related to times and dates."),
|
||||
);
|
||||
];
|
||||
|
||||
// Site-wide global tokens.
|
||||
$site['name'] = array(
|
||||
$site['name'] = [
|
||||
'name' => t("Name"),
|
||||
'description' => t("The name of the site."),
|
||||
);
|
||||
$site['slogan'] = array(
|
||||
];
|
||||
$site['slogan'] = [
|
||||
'name' => t("Slogan"),
|
||||
'description' => t("The slogan of the site."),
|
||||
);
|
||||
$site['mail'] = array(
|
||||
];
|
||||
$site['mail'] = [
|
||||
'name' => t("Email"),
|
||||
'description' => t("The administrative email address for the site."),
|
||||
);
|
||||
$site['url'] = array(
|
||||
];
|
||||
$site['url'] = [
|
||||
'name' => t("URL"),
|
||||
'description' => t("The URL of the site's front page."),
|
||||
);
|
||||
$site['url-brief'] = array(
|
||||
];
|
||||
$site['url-brief'] = [
|
||||
'name' => t("URL (brief)"),
|
||||
'description' => t("The URL of the site's front page without the protocol."),
|
||||
);
|
||||
$site['login-url'] = array(
|
||||
];
|
||||
$site['login-url'] = [
|
||||
'name' => t("Login page"),
|
||||
'description' => t("The URL of the site's login page."),
|
||||
);
|
||||
];
|
||||
|
||||
// Date related tokens.
|
||||
$date['short'] = array(
|
||||
$date['short'] = [
|
||||
'name' => t("Short format"),
|
||||
'description' => t("A date in 'short' format. (%date)", array('%date' => format_date(REQUEST_TIME, 'short'))),
|
||||
);
|
||||
$date['medium'] = array(
|
||||
'description' => t("A date in 'short' format. (%date)", ['%date' => format_date(REQUEST_TIME, 'short')]),
|
||||
];
|
||||
$date['medium'] = [
|
||||
'name' => t("Medium format"),
|
||||
'description' => t("A date in 'medium' format. (%date)", array('%date' => format_date(REQUEST_TIME, 'medium'))),
|
||||
);
|
||||
$date['long'] = array(
|
||||
'description' => t("A date in 'medium' format. (%date)", ['%date' => format_date(REQUEST_TIME, 'medium')]),
|
||||
];
|
||||
$date['long'] = [
|
||||
'name' => t("Long format"),
|
||||
'description' => t("A date in 'long' format. (%date)", array('%date' => format_date(REQUEST_TIME, 'long'))),
|
||||
);
|
||||
$date['custom'] = array(
|
||||
'description' => t("A date in 'long' format. (%date)", ['%date' => format_date(REQUEST_TIME, 'long')]),
|
||||
];
|
||||
$date['custom'] = [
|
||||
'name' => t("Custom format"),
|
||||
'description' => t('A date in a custom format. See <a href="http://php.net/manual/function.date.php">the PHP documentation</a> for details.'),
|
||||
);
|
||||
$date['since'] = array(
|
||||
];
|
||||
$date['since'] = [
|
||||
'name' => t("Time-since"),
|
||||
'description' => t("A date in 'time-since' format. (%date)", array('%date' => \Drupal::service('date.formatter')->formatTimeDiffSince(REQUEST_TIME - 360))),
|
||||
);
|
||||
$date['raw'] = array(
|
||||
'description' => t("A date in 'time-since' format. (%date)", ['%date' => \Drupal::service('date.formatter')->formatTimeDiffSince(REQUEST_TIME - 360)]),
|
||||
];
|
||||
$date['raw'] = [
|
||||
'name' => t("Raw timestamp"),
|
||||
'description' => t("A date in UNIX timestamp format (%date)", array('%date' => REQUEST_TIME)),
|
||||
);
|
||||
'description' => t("A date in UNIX timestamp format (%date)", ['%date' => REQUEST_TIME]),
|
||||
];
|
||||
|
||||
return array(
|
||||
return [
|
||||
'types' => $types,
|
||||
'tokens' => array(
|
||||
'tokens' => [
|
||||
'site' => $site,
|
||||
'date' => $date,
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -90,7 +90,7 @@ function system_token_info() {
|
|||
function system_tokens($type, $tokens, array $data, array $options, BubbleableMetadata $bubbleable_metadata) {
|
||||
$token_service = \Drupal::token();
|
||||
|
||||
$url_options = array('absolute' => TRUE);
|
||||
$url_options = ['absolute' => TRUE];
|
||||
if (isset($options['langcode'])) {
|
||||
$url_options['language'] = \Drupal::languageManager()->getLanguage($options['langcode']);
|
||||
$langcode = $options['langcode'];
|
||||
|
@ -98,7 +98,7 @@ function system_tokens($type, $tokens, array $data, array $options, BubbleableMe
|
|||
else {
|
||||
$langcode = NULL;
|
||||
}
|
||||
$replacements = array();
|
||||
$replacements = [];
|
||||
|
||||
if ($type == 'site') {
|
||||
foreach ($tokens as $name => $original) {
|
||||
|
@ -129,16 +129,16 @@ function system_tokens($type, $tokens, array $data, array $options, BubbleableMe
|
|||
|
||||
case 'url':
|
||||
/** @var \Drupal\Core\GeneratedUrl $result */
|
||||
$result = \Drupal::url('<front>', array(), $url_options, TRUE);
|
||||
$result = \Drupal::url('<front>', [], $url_options, TRUE);
|
||||
$bubbleable_metadata->addCacheableDependency($result);
|
||||
$replacements[$original] = $result->getGeneratedUrl();
|
||||
break;
|
||||
|
||||
case 'url-brief':
|
||||
/** @var \Drupal\Core\GeneratedUrl $result */
|
||||
$result = \Drupal::url('<front>', array(), $url_options, TRUE);
|
||||
$result = \Drupal::url('<front>', [], $url_options, TRUE);
|
||||
$bubbleable_metadata->addCacheableDependency($result);
|
||||
$replacements[$original] = preg_replace(array('!^https?://!', '!/$!'), '', $result->getGeneratedUrl());
|
||||
$replacements[$original] = preg_replace(['!^https?://!', '!/$!'], '', $result->getGeneratedUrl());
|
||||
break;
|
||||
|
||||
case 'login-url':
|
||||
|
@ -173,7 +173,7 @@ function system_tokens($type, $tokens, array $data, array $options, BubbleableMe
|
|||
break;
|
||||
|
||||
case 'since':
|
||||
$replacements[$original] = \Drupal::service('date.formatter')->formatTimeDiffSince($date, array('langcode' => $langcode));
|
||||
$replacements[$original] = \Drupal::service('date.formatter')->formatTimeDiffSince($date, ['langcode' => $langcode]);
|
||||
$bubbleable_metadata->setCacheMaxAge(0);
|
||||
break;
|
||||
|
||||
|
|
Reference in a new issue