Update to drupal 8.0.0-rc1. For more information, see https://www.drupal.org/node/2582663

This commit is contained in:
Greg Anderson 2015-10-08 11:40:12 -07:00
parent eb34d130a8
commit f32e58e4b1
8476 changed files with 211648 additions and 170042 deletions

View file

@ -5,7 +5,6 @@
* Builds placeholder replacement tokens for user-related data.
*/
use Drupal\Component\Utility\Html;
use Drupal\Core\Datetime\Entity\DateFormat;
use Drupal\Core\Render\BubbleableMetadata;
use Drupal\user\Entity\User;
@ -30,9 +29,17 @@ function user_token_info() {
'description' => t("The unique ID of the user account."),
);
$user['name'] = array(
'name' => t("Name"),
'name' => t("Deprecated: User Name"),
'description' => t("Deprecated: Use account-name or display-name instead."),
);
$user['account-name'] = array(
'name' => t("Account Name"),
'description' => t("The login name of the user account."),
);
$user['display-name'] = array(
'name' => t("Display Name"),
'description' => t("The display name of the user account."),
);
$user['mail'] = array(
'name' => t("Email"),
'description' => t("The email address of the user account."),
@ -77,8 +84,6 @@ function user_tokens($type, $tokens, array $data, array $options, BubbleableMeta
else {
$langcode = NULL;
}
$sanitize = !empty($options['sanitize']);
$replacements = array();
if ($type == 'user' && !empty($data['user'])) {
@ -92,16 +97,24 @@ function user_tokens($type, $tokens, array $data, array $options, BubbleableMeta
$replacements[$original] = $account->id() ?: t('not yet assigned');
break;
case 'name':
$name = user_format_name($account);
case 'display-name':
$replacements[$original] = $account->getDisplayName();
if ($account->isAnonymous()) {
$bubbleable_metadata->addCacheableDependency(\Drupal::config('user.settings'));
}
break;
case 'name':
case 'account-name':
$display_name = $account->getAccountName();
$replacements[$original] = $display_name;
if ($account->isAnonymous()) {
$bubbleable_metadata->addCacheableDependency(\Drupal::config('user.settings'));
}
$replacements[$original] = $sanitize ? Html::escape($name) : $name;
break;
case 'mail':
$replacements[$original] = $sanitize ? Html::escape($account->getEmail()) : $account->getEmail();
$replacements[$original] = $account->getEmail();
break;
case 'url':