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,9 +5,7 @@
* Builds placeholder replacement tokens for comment-related data.
*/
use Drupal\Component\Utility\Html;
use Drupal\Component\Utility\UrlHelper;
use Drupal\Component\Utility\Xss;
use Drupal\Core\Datetime\Entity\DateFormat;
use Drupal\Core\Render\BubbleableMetadata;
@ -119,8 +117,6 @@ function comment_tokens($type, $tokens, array $data, array $options, BubbleableM
else {
$langcode = NULL;
}
$sanitize = !empty($options['sanitize']);
$replacements = array();
if ($type == 'comment' && !empty($data['comment'])) {
@ -136,7 +132,7 @@ function comment_tokens($type, $tokens, array $data, array $options, BubbleableM
// Poster identity information for comments.
case 'hostname':
$replacements[$original] = $sanitize ? Html::escape($comment->getHostname()) : $comment->getHostname();
$replacements[$original] = $comment->getHostname();
break;
case 'mail':
@ -146,23 +142,25 @@ function comment_tokens($type, $tokens, array $data, array $options, BubbleableM
if ($comment->getOwnerId()) {
$bubbleable_metadata->addCacheableDependency($comment->getOwner());
}
$replacements[$original] = $sanitize ? Html::escape($mail) : $mail;
$replacements[$original] = $mail;
break;
case 'homepage':
$replacements[$original] = $sanitize ? UrlHelper::filterBadProtocol($comment->getHomepage()) : $comment->getHomepage();
$replacements[$original] = UrlHelper::stripDangerousProtocols($comment->getHomepage());
break;
case 'title':
$replacements[$original] = $sanitize ? Xss::filter($comment->getSubject()) : $comment->getSubject();
$replacements[$original] = $comment->getSubject();
break;
case 'body':
$replacements[$original] = $sanitize ? $comment->comment_body->processed : $comment->comment_body->value;
// "processed" returns a \Drupal\Component\Render\MarkupInterface via
// check_markup().
$replacements[$original] = $comment->comment_body->processed;
break;
case 'langcode':
$replacements[$original] = $sanitize ? Html::escape($comment->language()->getId()) : $comment->language()->getId();
$replacements[$original] = $comment->language()->getId();
break;
// Comment related URLs.
@ -183,14 +181,14 @@ function comment_tokens($type, $tokens, array $data, array $options, BubbleableM
if ($comment->getOwnerId()) {
$bubbleable_metadata->addCacheableDependency($comment->getOwner());
}
$replacements[$original] = $sanitize ? Xss::filter($name) : $name;
$replacements[$original] = $name;
break;
case 'parent':
if ($comment->hasParentComment()) {
$parent = $comment->getParentComment();
$bubbleable_metadata->addCacheableDependency($parent);
$replacements[$original] = $sanitize ? Xss::filter($parent->getSubject()) : $parent->getSubject();
$replacements[$original] = $parent->getSubject();
}
break;
@ -210,7 +208,7 @@ function comment_tokens($type, $tokens, array $data, array $options, BubbleableM
$entity = $comment->getCommentedEntity();
$bubbleable_metadata->addCacheableDependency($entity);
$title = $entity->label();
$replacements[$original] = $sanitize ? Xss::filter($title) : $title;
$replacements[$original] = $title;
break;
}
}