diff --git a/core/includes/common.inc b/core/includes/common.inc index f30bcdf..af5dce9 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -28,6 +28,7 @@ use Drupal\Core\EventSubscriber\HtmlViewSubscriber; use Drupal\Core\Routing\GeneratorNotInitializedException; use Drupal\Core\Template\Attribute; +use Drupal\Core\Template\Markup; use Drupal\Core\Render\Element; use Drupal\Core\Session\AnonymousUserSession; @@ -915,7 +916,7 @@ function l($text, $path, array $options = array()) { // Sanitize the link text if necessary. $text = $variables['options']['html'] ? $variables['text'] : String::checkPlain($variables['text']); - return '' . $text . ''; + return new Markup('' . $text . ''); } /** @@ -3481,7 +3482,7 @@ function drupal_render(&$elements, $is_recursive_call = FALSE) { } $elements['#printed'] = TRUE; - return $elements['#markup']; + return new Markup($elements['#markup']); } /** @@ -3509,7 +3510,7 @@ function drupal_render_children(&$element, $children_keys = NULL) { $output .= drupal_render($element[$key]); } } - return $output; + return new Markup($output); } /** diff --git a/core/includes/form.inc b/core/includes/form.inc index 42206a4..d23b412 100644 --- a/core/includes/form.inc +++ b/core/includes/form.inc @@ -15,6 +15,7 @@ use Drupal\Core\Language\Language; use Drupal\Core\Render\Element; use Drupal\Core\Template\Attribute; +use Drupal\Core\Template\Markup; use Drupal\Core\Utility\Color; use Symfony\Component\HttpFoundation\RedirectResponse; @@ -1070,7 +1071,7 @@ function template_preprocess_fieldset(&$variables) { $variables['attributes']['class'][] = 'form-item'; $variables['prefix'] = isset($element['#field_prefix']) ? $element['#field_prefix'] : NULL; $variables['suffix'] = isset($element['#field_suffix']) ? $element['#field_suffix'] : NULL; - $variables['children'] = $element['#children']; + $variables['children'] = new Markup($element['#children']); $legend_attributes = array(); if (isset($element['#title_display']) && $element['#title_display'] == 'invisible') { $legend_attributes['class'][] = 'visually-hidden'; @@ -1176,7 +1177,7 @@ function template_preprocess_radios(&$variables) { if (isset($element['#attributes']['title'])) { $variables['attributes']['title'] = $element['#attributes']['title']; } - $variables['children'] = $element['#children']; + $variables['children'] = new Markup($element['#children']); } /** @@ -1354,7 +1355,7 @@ function template_preprocess_checkboxes(&$variables) { if (isset($element['#attributes']['title'])) { $variables['attributes']['title'] = $element['#attributes']['title']; } - $variables['children'] = $element['#children']; + $variables['children'] = new Markup($element['#children']); } /** @@ -2727,7 +2728,7 @@ function template_preprocess_form(&$variables) { $element['#attributes']['accept-charset'] = "UTF-8"; } $variables['attributes'] = $element['#attributes']; - $variables['children'] = $element['#children']; + $variables['children'] = new Markup($element['#children']); } /** @@ -2943,7 +2944,7 @@ function template_preprocess_form_element(&$variables) { $variables['label'] = array('#theme' => 'form_element_label'); $variables['label'] += array_intersect_key($element, array_flip(array('#id', '#required', '#title', '#title_display'))); - $variables['children'] = $element['#children']; + $variables['children'] = new Markup($element['#children']); } /** diff --git a/core/includes/theme.inc b/core/includes/theme.inc index e44f13d..df7f438 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -20,6 +20,7 @@ use Drupal\Core\Page\LinkElement; use Drupal\Core\Page\MetaElement; use Drupal\Core\Template\Attribute; +use Drupal\Core\Template\Markup; use Drupal\Core\Template\RenderWrapper; use Drupal\Core\Theme\ThemeSettings; use Drupal\Component\Utility\NestedArray; @@ -650,7 +651,8 @@ function _theme($hook, $variables = array()) { // restore path_to_theme() $theme_path = $temp; - return (string) $output; + + return new Markup($output); } /** @@ -1838,7 +1840,7 @@ function template_preprocess_container(&$variables) { $element['#attributes']['class'][] = 'form-wrapper'; } - $variables['children'] = $element['#children']; + $variables['children'] = new Markup($element['#children']); $variables['attributes'] = $element['#attributes']; } @@ -2078,7 +2080,7 @@ function template_preprocess_page(&$variables) { // Move some variables to the top level for themer convenience and template cleanliness. $variables['show_messages'] = $variables['page']['#show_messages']; - $variables['title'] = $variables['page']['#title']; + $variables['title'] = new Markup($variables['page']['#title']); foreach (system_region_list($GLOBALS['theme']) as $region_key => $region_name) { if (!isset($variables['page'][$region_key])) { @@ -2328,7 +2330,7 @@ function template_preprocess_install_page(&$variables) { */ function template_preprocess_region(&$variables) { // Create the $content variable that templates expect. - $variables['content'] = $variables['elements']['#children']; + $variables['content'] = new Markup($variables['elements']['#children']); $variables['region'] = $variables['elements']['#region']; $variables['attributes']['class'][] = 'region'; diff --git a/core/lib/Drupal/Core/CoreServiceProvider.php b/core/lib/Drupal/Core/CoreServiceProvider.php index fe23fb6..99784f7 100644 --- a/core/lib/Drupal/Core/CoreServiceProvider.php +++ b/core/lib/Drupal/Core/CoreServiceProvider.php @@ -101,7 +101,7 @@ public static function registerTwig(ContainerBuilder $container) { 'cache' => drupal_installation_attempted() ? FALSE : Settings::get('twig_cache', TRUE), // @todo Remove in followup issue // @see http://drupal.org/node/1712444. - 'autoescape' => FALSE, + 'autoescape' => TRUE, 'debug' => Settings::get('twig_debug', FALSE), 'auto_reload' => Settings::get('twig_auto_reload', NULL), )) diff --git a/core/lib/Drupal/Core/Template/Attribute.php b/core/lib/Drupal/Core/Template/Attribute.php index ead5d05..93e4340 100644 --- a/core/lib/Drupal/Core/Template/Attribute.php +++ b/core/lib/Drupal/Core/Template/Attribute.php @@ -31,7 +31,7 @@ * // Produces * @endcode */ -class Attribute implements \ArrayAccess, \IteratorAggregate { +class Attribute extends \Twig_Markup implements \ArrayAccess, \IteratorAggregate { /** * Stores the attribute data. diff --git a/core/lib/Drupal/Core/Template/Markup.php b/core/lib/Drupal/Core/Template/Markup.php new file mode 100644 index 0000000..fb53545 --- /dev/null +++ b/core/lib/Drupal/Core/Template/Markup.php @@ -0,0 +1,51 @@ +content = $content; + $this->charset = $charset; + } + + /** + * Implements the magic __toString() method. + */ + public function __toString() { + return (string) $this->render(); + } + + /** + * Renders the markup. + * + * @return string + * The results of the callback function. + */ + public function render() { + return $this->content; + } + +} diff --git a/core/lib/Drupal/Core/Template/RenderWrapper.php b/core/lib/Drupal/Core/Template/RenderWrapper.php index 7d7770d..58888e6 100644 --- a/core/lib/Drupal/Core/Template/RenderWrapper.php +++ b/core/lib/Drupal/Core/Template/RenderWrapper.php @@ -16,7 +16,7 @@ * $variables['scripts'] = new RenderWrapper('drupal_get_js', array('footer')); * @endcode */ -class RenderWrapper { +class RenderWrapper extends \Twig_Markup { /** * Stores the callback function to be called when rendered. @@ -52,7 +52,7 @@ public function __construct($callback, array $args = array()) { * Implements the magic __toString() method. */ public function __toString() { - return $this->render(); + return (string) $this->render(); } /** diff --git a/core/modules/aggregator/templates/aggregator-feed-source.html.twig b/core/modules/aggregator/templates/aggregator-feed-source.html.twig index d492904..3dc348b 100644 --- a/core/modules/aggregator/templates/aggregator-feed-source.html.twig +++ b/core/modules/aggregator/templates/aggregator-feed-source.html.twig @@ -22,7 +22,7 @@ {{ source_icon }} {{ source_image }} -

{{ source_description }}

+

{{ source_description|raw }}

{{ 'URL'|t }}
{{ source_url }}
diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockTypeListBuilder.php b/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockTypeListBuilder.php index 723ea71..e8e5243 100644 --- a/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockTypeListBuilder.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockTypeListBuilder.php @@ -10,6 +10,7 @@ use Drupal\Component\Utility\Xss; use Drupal\Core\Config\Entity\ConfigEntityListBuilder; use Drupal\Core\Entity\EntityInterface; +use Drupal\Core\Template\Markup; /** * Defines a class to build a listing of custom block type entities. @@ -45,7 +46,7 @@ public function buildHeader() { */ public function buildRow(EntityInterface $entity) { $row['type'] = \Drupal::linkGenerator()->generateFromUrl($entity->label(), $entity->urlInfo()); - $row['description'] = Xss::filterAdmin($entity->description); + $row['description'] = new Markup(Xss::filterAdmin($entity->description)); return $row + parent::buildRow($entity); } diff --git a/core/modules/block/custom_block/templates/custom-block-add-list.html.twig b/core/modules/block/custom_block/templates/custom-block-add-list.html.twig index d2af8e8..615f9ee 100644 --- a/core/modules/block/custom_block/templates/custom-block-add-list.html.twig +++ b/core/modules/block/custom_block/templates/custom-block-add-list.html.twig @@ -18,7 +18,7 @@
{% for type in types %}
{{ type.link }}
-
{{ type.description }}
+
{{ type.description|raw }}
{% endfor %}
{% endspaceless %} diff --git a/core/modules/book/lib/Drupal/book/Tests/BookTest.php b/core/modules/book/lib/Drupal/book/Tests/BookTest.php index cfd7559..b5f0ee8 100644 --- a/core/modules/book/lib/Drupal/book/Tests/BookTest.php +++ b/core/modules/book/lib/Drupal/book/Tests/BookTest.php @@ -193,15 +193,15 @@ function checkBookNode(EntityInterface $node, $nodes, $previous = FALSE, $up = F // Check previous, up, and next links. if ($previous) { - $this->assertRaw(l(' ' . $previous->label(), 'node/' . $previous->id(), array('html' => TRUE, 'attributes' => array('rel' => array('prev'), 'title' => t('Go to previous page')))), 'Previous page link found.'); + $this->assertRaw((string) l(' ' . $previous->label(), 'node/' . $previous->id(), array('html' => TRUE, 'attributes' => array('rel' => array('prev'), 'title' => t('Go to previous page')))), 'Previous page link found.'); } if ($up) { - $this->assertRaw(l('Up', 'node/' . $up->id(), array('html'=> TRUE, 'attributes' => array('title' => t('Go to parent page')))), 'Up page link found.'); + $this->assertRaw((string) l('Up', 'node/' . $up->id(), array('html'=> TRUE, 'attributes' => array('title' => t('Go to parent page')))), 'Up page link found.'); } if ($next) { - $this->assertRaw(l($next->label() . ' ', 'node/' . $next->id(), array('html'=> TRUE, 'attributes' => array('rel' => array('next'), 'title' => t('Go to next page')))), 'Next page link found.'); + $this->assertRaw((string) l($next->label() . ' ', 'node/' . $next->id(), array('html'=> TRUE, 'attributes' => array('rel' => array('next'), 'title' => t('Go to next page')))), 'Next page link found.'); } // Compute the expected breadcrumb. diff --git a/core/modules/book/templates/book-node-export-html.html.twig b/core/modules/book/templates/book-node-export-html.html.twig index 0efa9a7..57b5662 100644 --- a/core/modules/book/templates/book-node-export-html.html.twig +++ b/core/modules/book/templates/book-node-export-html.html.twig @@ -18,5 +18,5 @@

{{ title }}

{{ content }} - {{ children }} + {{ children|raw }}
diff --git a/core/modules/color/templates/color-scheme-form.html.twig b/core/modules/color/templates/color-scheme-form.html.twig index 694c6f7..eb99781 100644 --- a/core/modules/color/templates/color-scheme-form.html.twig +++ b/core/modules/color/templates/color-scheme-form.html.twig @@ -22,5 +22,5 @@ {{ form|without('scheme', 'palette') }}

{{ 'Preview'|t }}

- {{ html_preview }} + {{ html_preview|raw }} diff --git a/core/modules/comment/templates/comment.html.twig b/core/modules/comment/templates/comment.html.twig index 5fca73b..aafa668 100644 --- a/core/modules/comment/templates/comment.html.twig +++ b/core/modules/comment/templates/comment.html.twig @@ -79,8 +79,8 @@ {{ title_suffix }}
- {{ user_picture }} - + {{ user_picture|raw }} + {# Indicate the semantic relationship between parent and child comments @@ -91,7 +91,7 @@

{{ parent }}

{% endif %} - {{ permalink }} + {{ permalink|raw }}
diff --git a/core/modules/contextual/lib/Drupal/contextual/ContextualController.php b/core/modules/contextual/lib/Drupal/contextual/ContextualController.php index aeee4a6..dd2bed4 100644 --- a/core/modules/contextual/lib/Drupal/contextual/ContextualController.php +++ b/core/modules/contextual/lib/Drupal/contextual/ContextualController.php @@ -44,7 +44,7 @@ public function render(Request $request) { '#type' => 'contextual_links', '#contextual_links' => _contextual_id_to_links($id), ); - $rendered[$id] = drupal_render($element); + $rendered[$id] = (string) drupal_render($element); } return new JsonResponse($rendered); diff --git a/core/modules/datetime/datetime.module b/core/modules/datetime/datetime.module index 3d13b7b..9a7cf16 100644 --- a/core/modules/datetime/datetime.module +++ b/core/modules/datetime/datetime.module @@ -8,6 +8,7 @@ use Drupal\Component\Utility\NestedArray; use Drupal\Core\Datetime\DrupalDateTime; use Drupal\Core\Template\Attribute; +use Drupal\Core\Template\Markup; use Drupal\datetime\DateHelper; use Drupal\node\NodeInterface; @@ -241,7 +242,7 @@ function template_preprocess_datetime_wrapper(&$variables) { $title_attributes['class'][] = 'form-required'; } $variables['title_attributes'] = new Attribute($title_attributes); - $variables['content'] = $element['#children']; + $variables['content'] = new Markup($element['#children']); } /** diff --git a/core/modules/filter/templates/filter-guidelines.html.twig b/core/modules/filter/templates/filter-guidelines.html.twig index 88a3b47..ecf9b94 100644 --- a/core/modules/filter/templates/filter-guidelines.html.twig +++ b/core/modules/filter/templates/filter-guidelines.html.twig @@ -20,6 +20,6 @@ */ #} -

{{ format.name|escape }}

+

{{ format.name }}

{{ tips }} diff --git a/core/modules/filter/templates/filter-tips.html.twig b/core/modules/filter/templates/filter-tips.html.twig index d8f70cb..27a3943 100644 --- a/core/modules/filter/templates/filter-tips.html.twig +++ b/core/modules/filter/templates/filter-tips.html.twig @@ -36,7 +36,7 @@ {% if tip.list|length %}
    {% for item in tip.list %} - {{ item.tip }} + {{ item.tip|raw }} {% endfor %}
{% endif %} diff --git a/core/modules/filter/templates/text-format-wrapper.html.twig b/core/modules/filter/templates/text-format-wrapper.html.twig index b4ff1cc..e2a103e 100644 --- a/core/modules/filter/templates/text-format-wrapper.html.twig +++ b/core/modules/filter/templates/text-format-wrapper.html.twig @@ -14,8 +14,8 @@ */ #}
- {{ children }} + {{ children|raw }} {% if description %} - {{ description }}
+ {{ description|raw }} {% endif %} diff --git a/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php b/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php index 6217835..cca701d 100644 --- a/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php +++ b/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php @@ -564,7 +564,7 @@ private function verifyForums(EntityInterface $node, $admin, $response = 200) { '#theme' => 'breadcrumb', '#breadcrumb' => $breadcrumb_build, ); - $this->assertRaw(drupal_render($breadcrumb), 'Breadcrumbs were displayed'); + $this->assertRaw((string) drupal_render($breadcrumb), 'Breadcrumbs were displayed'); // View forum edit node. $this->drupalGet('node/' . $node->id() . '/edit'); @@ -624,7 +624,7 @@ private function verifyForumView($forum, $parent = NULL) { '#theme' => 'breadcrumb', '#breadcrumb' => $breadcrumb_build, ); - $this->assertRaw(drupal_render($breadcrumb), 'Breadcrumbs were displayed'); + $this->assertRaw((string) drupal_render($breadcrumb), 'Breadcrumbs were displayed'); } /** diff --git a/core/modules/node/lib/Drupal/node/NodeTypeListBuilder.php b/core/modules/node/lib/Drupal/node/NodeTypeListBuilder.php index 779672a..8ace778 100644 --- a/core/modules/node/lib/Drupal/node/NodeTypeListBuilder.php +++ b/core/modules/node/lib/Drupal/node/NodeTypeListBuilder.php @@ -13,6 +13,7 @@ use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Routing\UrlGeneratorInterface; use Drupal\Core\Entity\EntityInterface; +use Drupal\Core\Template\Markup; use Drupal\Component\Utility\Xss; use Drupal\Component\Utility\String; @@ -76,7 +77,7 @@ public function buildRow(EntityInterface $entity) { 'data' => $this->getLabel($entity), 'class' => array('menu-label'), ); - $row['description'] = Xss::filterAdmin($entity->description); + $row['description'] = new Markup(Xss::filterAdmin($entity->description)); return $row + parent::buildRow($entity); } diff --git a/core/modules/node/templates/node-add-list.html.twig b/core/modules/node/templates/node-add-list.html.twig index 7323896..29ed28c 100644 --- a/core/modules/node/templates/node-add-list.html.twig +++ b/core/modules/node/templates/node-add-list.html.twig @@ -19,7 +19,7 @@
{% for type in types %}
{{ type.add_link }}
-
{{ type.description }}
+
{{ type.description|raw }}
{% endfor %}
{% else %} diff --git a/core/modules/node/templates/node.html.twig b/core/modules/node/templates/node.html.twig index ae1162e..2b47e64 100644 --- a/core/modules/node/templates/node.html.twig +++ b/core/modules/node/templates/node.html.twig @@ -88,7 +88,7 @@ {% if display_submitted %}
{{ user_picture }} - +
{% endif %} diff --git a/core/modules/simpletest/lib/Drupal/simpletest/Form/SimpletestResultsForm.php b/core/modules/simpletest/lib/Drupal/simpletest/Form/SimpletestResultsForm.php index 299f305..fb7dc65 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/Form/SimpletestResultsForm.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/Form/SimpletestResultsForm.php @@ -9,6 +9,7 @@ use Drupal\Core\Database\Connection; use Drupal\Core\Form\FormBase; +use Drupal\Core\Template\Markup; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\RedirectResponse; @@ -155,7 +156,7 @@ public function buildForm(array $form, array &$form_state, $test_id = NULL) { $rows = array(); foreach ($assertions as $assertion) { $row = array(); - $row[] = $assertion->message; + $row[] = new Markup($assertion->message); $row[] = $assertion->message_group; $row[] = drupal_basename($assertion->file); $row[] = $assertion->line; diff --git a/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsReportsTest.php b/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsReportsTest.php index 3d8309a..7066e21 100644 --- a/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsReportsTest.php +++ b/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsReportsTest.php @@ -55,7 +55,7 @@ function testPopularContentBlock() { $this->assertText('All time', 'Found the all time popular content.'); $this->assertText('Last viewed', 'Found the last viewed popular content.'); - $this->assertRaw(l($node->label(), 'node/' . $node->id()), 'Found link to visited node.'); + $this->assertRaw((string) l($node->label(), 'node/' . $node->id()), 'Found link to visited node.'); } } diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/RenderTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/RenderTest.php index caa80a2..d3b21e3 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Common/RenderTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Common/RenderTest.php @@ -277,7 +277,8 @@ function testDrupalRenderBasics() { ); foreach($types as $type) { - $this->assertIdentical(drupal_render($type['value']), $type['expected'], '"' . $type['name'] . '" input rendered correctly by drupal_render().'); + $value = drupal_render($type['value']); + $this->assertIdentical((string) $value, $type['expected'], '"' . $type['name'] . '" input rendered correctly by drupal_render().'); } } @@ -394,14 +395,14 @@ function testDrupalRenderThemeArguments() { '#theme' => 'common_test_foo', ); // Test that defaults work. - $this->assertEqual(drupal_render($element), 'foobar', 'Defaults work'); + $this->assertEqual((string) drupal_render($element), 'foobar', 'Defaults work'); $element = array( '#theme' => 'common_test_foo', '#foo' => $this->randomName(), '#bar' => $this->randomName(), ); // Tests that passing arguments to the theme function works. - $this->assertEqual(drupal_render($element), $element['#foo'] . $element['#bar'], 'Passing arguments to theme functions works'); + $this->assertEqual((string) drupal_render($element), $element['#foo'] . $element['#bar'], 'Passing arguments to theme functions works'); } /** @@ -470,7 +471,7 @@ function testDrupalRenderPostRenderCache() { $element = $test_element; $element['#markup'] = '

#cache disabled

'; $output = drupal_render($element); - $this->assertIdentical($output, '

overridden

', 'Output is overridden.'); + $this->assertIdentical((string) $output, '

overridden

', 'Output is overridden.'); $this->assertIdentical($element['#markup'], '

overridden

', '#markup is overridden.'); $settings = $this->parseDrupalSettings(drupal_get_js()); $this->assertIdentical($settings['foo'], 'bar', 'Original JavaScript setting is added to the page.'); @@ -486,7 +487,7 @@ function testDrupalRenderPostRenderCache() { $element['#cache'] = array('cid' => 'post_render_cache_test_GET'); $element['#markup'] = '

#cache enabled, GET

'; $output = drupal_render($element); - $this->assertIdentical($output, '

overridden

', 'Output is overridden.'); + $this->assertIdentical((string) $output, '

overridden

', 'Output is overridden.'); $this->assertTrue(isset($element['#printed']), 'No cache hit'); $this->assertIdentical($element['#markup'], '

overridden

', '#markup is overridden.'); $settings = $this->parseDrupalSettings(drupal_get_js()); @@ -509,7 +510,7 @@ function testDrupalRenderPostRenderCache() { $element['#cache'] = array('cid' => 'post_render_cache_test_GET'); $element['#markup'] = '

#cache enabled, GET

'; $output = drupal_render($element); - $this->assertIdentical($output, '

overridden

', 'Output is overridden.'); + $this->assertIdentical((string) $output, '

overridden

', 'Output is overridden.'); $this->assertFalse(isset($element['#printed']), 'Cache hit'); $this->assertIdentical($element['#markup'], '

overridden

', '#markup is overridden.'); $settings = $this->parseDrupalSettings(drupal_get_js()); @@ -526,7 +527,7 @@ function testDrupalRenderPostRenderCache() { $element['#cache'] = array('cid' => 'post_render_cache_test_POST'); $element['#markup'] = '

#cache enabled, POST

'; $output = drupal_render($element); - $this->assertIdentical($output, '

overridden

', 'Output is overridden.'); + $this->assertIdentical((string) $output, '

overridden

', 'Output is overridden.'); $this->assertTrue(isset($element['#printed']), 'No cache hit'); $this->assertIdentical($element['#markup'], '

overridden

', '#markup is overridden.'); $settings = $this->parseDrupalSettings(drupal_get_js()); @@ -589,7 +590,7 @@ function testDrupalRenderChildrenPostRenderCache() { ); $element = $test_element; $output = drupal_render($element); - $this->assertIdentical($output, '

overridden

', 'Output is overridden.'); + $this->assertIdentical((string) $output, '

overridden

', 'Output is overridden.'); $this->assertTrue(isset($element['#printed']), 'No cache hit'); $this->assertIdentical($element['#markup'], '

overridden

', '#markup is overridden.'); $settings = $this->parseDrupalSettings(drupal_get_js()); @@ -635,7 +636,7 @@ function testDrupalRenderChildrenPostRenderCache() { drupal_static_reset('_drupal_add_js'); $element = $test_element; $output = drupal_render($element); - $this->assertIdentical($output, '

overridden

', 'Output is overridden.'); + $this->assertIdentical((string) $output, '

overridden

', 'Output is overridden.'); $this->assertFalse(isset($element['#printed']), 'Cache hit'); $settings = $this->parseDrupalSettings(drupal_get_js()); $this->assertIdentical($settings['foo'], 'bar', 'Original JavaScript setting is added to the page.'); @@ -647,7 +648,7 @@ function testDrupalRenderChildrenPostRenderCache() { unset($test_element['#cache']); $element = $test_element; $output = drupal_render($element); - $this->assertIdentical($output, '

overridden

', 'Output is overridden.'); + $this->assertIdentical((string) $output, '

overridden

', 'Output is overridden.'); $this->assertIdentical($element['#markup'], '

overridden

', '#markup is overridden.'); $settings = $this->parseDrupalSettings(drupal_get_js()); $expected_settings = $context_1 + $context_2 + $context_3; @@ -667,7 +668,7 @@ function testDrupalRenderChildrenPostRenderCache() { $element['#cache']['keys'] = array('simpletest', 'drupal_render', 'children_post_render_cache', 'nested_cache_parent'); $element['child']['#cache']['keys'] = array('simpletest', 'drupal_render', 'children_post_render_cache', 'nested_cache_child'); $output = drupal_render($element); - $this->assertIdentical($output, '

overridden

', 'Output is overridden.'); + $this->assertIdentical((string) $output, '

overridden

', 'Output is overridden.'); $this->assertTrue(isset($element['#printed']), 'No cache hit'); $this->assertIdentical($element['#markup'], '

overridden

', '#markup is overridden.'); $settings = $this->parseDrupalSettings(drupal_get_js()); @@ -742,7 +743,7 @@ function testDrupalRenderChildrenPostRenderCache() { $element = $test_element; $element['#cache']['keys'] = array('simpletest', 'drupal_render', 'children_post_render_cache', 'nested_cache_parent'); $output = drupal_render($element); - $this->assertIdentical($output, '

overridden

', 'Output is overridden.'); + $this->assertIdentical((string) $output, '

overridden

', 'Output is overridden.'); $this->assertFalse(isset($element['#printed']), 'Cache hit'); $settings = $this->parseDrupalSettings(drupal_get_js()); $this->assertIdentical($settings['foo'], 'bar', 'Original JavaScript setting is added to the page.'); @@ -754,7 +755,7 @@ function testDrupalRenderChildrenPostRenderCache() { $element['child']['#cache']['keys'] = array('simpletest', 'drupal_render', 'children_post_render_cache', 'nested_cache_child'); $element = $element['child']; $output = drupal_render($element); - $this->assertIdentical($output, '

overridden

', 'Output is overridden.'); + $this->assertIdentical((string) $output, '

overridden

', 'Output is overridden.'); $this->assertFalse(isset($element['#printed']), 'Cache hit'); $settings = $this->parseDrupalSettings(drupal_get_js()); $expected_settings = $context_2 + $context_3; @@ -790,7 +791,7 @@ function testDrupalRenderRenderCachePlaceholder() { drupal_static_reset('_drupal_add_js'); $element = $test_element; $output = drupal_render($element); - $this->assertIdentical($output, $expected_output, 'Placeholder was replaced in output'); + $this->assertIdentical((string) $output, $expected_output, 'Placeholder was replaced in output'); $settings = $this->parseDrupalSettings(drupal_get_js()); $this->assertIdentical($settings['common_test'], $context, '#attached is modified; JavaScript setting is added to page.'); @@ -803,7 +804,7 @@ function testDrupalRenderRenderCachePlaceholder() { $element = $test_element; $element['#cache'] = array('cid' => 'render_cache_placeholder_test_GET'); $output = drupal_render($element); - $this->assertIdentical($output, $expected_output, 'Placeholder was replaced in output'); + $this->assertIdentical((string) $output, $expected_output, 'Placeholder was replaced in output'); $this->assertTrue(isset($element['#printed']), 'No cache hit'); $this->assertIdentical($element['#markup'], $expected_output, 'Placeholder was replaced in #markup.'); $settings = $this->parseDrupalSettings(drupal_get_js()); @@ -840,7 +841,7 @@ function testDrupalRenderRenderCachePlaceholder() { $element = $test_element; $element['#cache'] = array('cid' => 'render_cache_placeholder_test_GET'); $output = drupal_render($element); - $this->assertIdentical($output, $expected_output, 'Placeholder was replaced in output'); + $this->assertIdentical((string) $output, $expected_output, 'Placeholder was replaced in output'); $this->assertFalse(isset($element['#printed']), 'Cache hit'); $this->assertIdentical($element['#markup'], $expected_output, 'Placeholder was replaced in #markup.'); $settings = $this->parseDrupalSettings(drupal_get_js()); @@ -880,7 +881,7 @@ function testDrupalRenderChildElementRenderCachePlaceholder() { drupal_static_reset('_drupal_add_js'); $element = $container; $output = drupal_render($element); - $this->assertIdentical($output, $expected_output, 'Placeholder was replaced in output'); + $this->assertIdentical((string) $output, $expected_output, 'Placeholder was replaced in output'); $settings = $this->parseDrupalSettings(drupal_get_js()); $this->assertIdentical($settings['common_test'], $context, '#attached is modified; JavaScript setting is added to page.'); @@ -899,7 +900,7 @@ function testDrupalRenderChildElementRenderCachePlaceholder() { $element['#children'] = drupal_render($child, TRUE); // Eventually, drupal_render() gets called on the root element. $output = drupal_render($element); - $this->assertIdentical($output, $expected_output, 'Placeholder was replaced in output'); + $this->assertIdentical((string) $output, $expected_output, 'Placeholder was replaced in output'); $this->assertTrue(isset($element['#printed']), 'No cache hit'); $this->assertIdentical($element['#markup'], $expected_output, 'Placeholder was replaced in #markup.'); $settings = $this->parseDrupalSettings(drupal_get_js()); @@ -996,7 +997,7 @@ function testDrupalRenderChildElementRenderCachePlaceholder() { $child = &$element['test_element']; $element['#children'] = drupal_render($child, TRUE); $output = drupal_render($element); - $this->assertIdentical($output, $expected_output, 'Placeholder was replaced in output'); + $this->assertIdentical((string) $output, $expected_output, 'Placeholder was replaced in output'); $this->assertFalse(isset($element['#printed']), 'Cache hit'); $this->assertIdentical($element['#markup'], $expected_output, 'Placeholder was replaced in #markup.'); $settings = $this->parseDrupalSettings(drupal_get_js()); diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc index 9ba1a1c..4b1147b 100644 --- a/core/modules/system/system.admin.inc +++ b/core/modules/system/system.admin.inc @@ -10,6 +10,7 @@ use Drupal\Core\Extension\Extension; use Drupal\Core\Render\Element; use Drupal\Core\Template\Attribute; +use Drupal\Core\Template\Markup; /** * Recursively check compatibility. @@ -58,9 +59,9 @@ function template_preprocess_admin_block_content(&$variables) { $variables['attributes']['class'][] = 'compact'; } foreach ($variables['content'] as $key => $item) { - $variables['content'][$key]['link'] = l($item['title'], $item['link_path'], $item['localized_options']); + $variables['content'][$key]['link'] = new Markup(l($item['title'], $item['link_path'], $item['localized_options'])); if (!$compact && isset($item['description'])) { - $variables['content'][$key]['description'] = Xss::filterAdmin($item['description']); + $variables['content'][$key]['description'] = new Markup(Xss::filterAdmin($item['description'])); } else { $variables['content'][$key]['description'] = FALSE; diff --git a/core/modules/system/templates/admin-block-content.html.twig b/core/modules/system/templates/admin-block-content.html.twig index a49bf10..6670bf9 100644 --- a/core/modules/system/templates/admin-block-content.html.twig +++ b/core/modules/system/templates/admin-block-content.html.twig @@ -20,7 +20,7 @@ {% for item in content %}
{{ item.link }}
{% if item.description %} -
{{ item.description }}
+
{{ item.description|raw }}
{% endif %} {% endfor %}
diff --git a/core/modules/system/templates/breadcrumb.html.twig b/core/modules/system/templates/breadcrumb.html.twig index 5f322f9..d36a426 100644 --- a/core/modules/system/templates/breadcrumb.html.twig +++ b/core/modules/system/templates/breadcrumb.html.twig @@ -14,7 +14,7 @@

{{ 'You are here'|t }}

    {% for item in breadcrumb %} -
  1. {{ item }}
  2. +
  3. {{ item|raw }}
  4. {% endfor %}
diff --git a/core/modules/system/templates/datetime.html.twig b/core/modules/system/templates/datetime.html.twig index 25ef788..183b834 100644 --- a/core/modules/system/templates/datetime.html.twig +++ b/core/modules/system/templates/datetime.html.twig @@ -25,5 +25,4 @@ * @see http://www.w3.org/TR/html5-author/the-time-element.html#attr-time-datetime */ #} -{# @todo Revisit once http://drupal.org/node/1825952 is resolved. #} -{{ html ? text|raw : text|escape }} +{{ html ? text|raw : text }} diff --git a/core/modules/system/templates/details.html.twig b/core/modules/system/templates/details.html.twig index 17ea820..6283dc2 100644 --- a/core/modules/system/templates/details.html.twig +++ b/core/modules/system/templates/details.html.twig @@ -17,17 +17,17 @@ #} {%- if title -%} - {{ title }} + {{ title|raw }} {%- endif -%}
{%- if description -%} -
{{ description }}
+
{{ description|raw }}
{%- endif -%} {%- if children -%} - {{ children }} + {{ children|raw }} {%- endif -%} {%- if value -%} - {{ value }} + {{ value|raw }} {%- endif -%}
diff --git a/core/modules/system/templates/dropbutton-wrapper.html.twig b/core/modules/system/templates/dropbutton-wrapper.html.twig index ca0ff7e..d92bb6e 100644 --- a/core/modules/system/templates/dropbutton-wrapper.html.twig +++ b/core/modules/system/templates/dropbutton-wrapper.html.twig @@ -16,7 +16,7 @@ {% spaceless %}
- {{ children }} + {{ children|raw }}
{% endspaceless %} diff --git a/core/modules/system/templates/form-element.html.twig b/core/modules/system/templates/form-element.html.twig index ea4d90f..bf9b76f 100644 --- a/core/modules/system/templates/form-element.html.twig +++ b/core/modules/system/templates/form-element.html.twig @@ -43,7 +43,7 @@ {% if prefix is not empty %} {{ prefix }} {% endif %} - {{ children }} + {{ children|raw }} {% if suffix is not empty %} {{ suffix }} {% endif %} @@ -52,7 +52,7 @@ {% endif %} {% if description.content %} - {{ description.content }} + {{ description.content|raw }} {% endif %} diff --git a/core/modules/system/templates/form.html.twig b/core/modules/system/templates/form.html.twig index 2cd1e95..9bf07f1 100644 --- a/core/modules/system/templates/form.html.twig +++ b/core/modules/system/templates/form.html.twig @@ -13,5 +13,5 @@ */ #} - {{ children }} + {{ children|raw }} diff --git a/core/modules/system/templates/item-list.html.twig b/core/modules/system/templates/item-list.html.twig index 34e1802..8e0a385 100644 --- a/core/modules/system/templates/item-list.html.twig +++ b/core/modules/system/templates/item-list.html.twig @@ -26,7 +26,7 @@ {%- if items -%} <{{ list_type }}{{ attributes }}> {%- for item in items -%} - {{ item.value }} + {{ item.value|raw }} {%- endfor -%} {%- else -%} diff --git a/core/modules/system/templates/select.html.twig b/core/modules/system/templates/select.html.twig index 21f32ac..6a24ffd 100644 --- a/core/modules/system/templates/select.html.twig +++ b/core/modules/system/templates/select.html.twig @@ -12,4 +12,4 @@ * @ingroup themeable */ #} -{{ options }} +{{ options|raw }} diff --git a/core/modules/system/templates/status-messages.html.twig b/core/modules/system/templates/status-messages.html.twig index 505eb20..e86df24 100644 --- a/core/modules/system/templates/status-messages.html.twig +++ b/core/modules/system/templates/status-messages.html.twig @@ -34,11 +34,11 @@ {% if messages|length > 1 %}
    {% for message in messages %} -
  • {{ message }}
  • +
  • {{ message|raw }}
  • {% endfor %}
{% else %} - {{ messages.0 }} + {{ messages.0|raw }} {% endif %} {% if type == 'error' %} diff --git a/core/modules/system/templates/status-report.html.twig b/core/modules/system/templates/status-report.html.twig index 7d0d96d..2c17e9c 100644 --- a/core/modules/system/templates/status-report.html.twig +++ b/core/modules/system/templates/status-report.html.twig @@ -33,9 +33,9 @@ {{ requirement.title }} - {{ requirement.value }} + {{ requirement.value|raw }} {% if requirement.description %} -
{{ requirement.description }}
+
{{ requirement.description|raw }}
{% endif %} diff --git a/core/modules/system/templates/system-themes-page.html.twig b/core/modules/system/templates/system-themes-page.html.twig index fa0e748..2c18ce3 100644 --- a/core/modules/system/templates/system-themes-page.html.twig +++ b/core/modules/system/templates/system-themes-page.html.twig @@ -42,7 +42,7 @@ ({{ theme.notes|join(', ') }}) {%- endif -%} -
{{ theme.description }}
+
{{ theme.description|raw }}
{# Display operation links if the theme is compatible. #} {% if theme.incompatible %}
{{ theme.incompatible }}
diff --git a/core/modules/system/templates/vertical-tabs.html.twig b/core/modules/system/templates/vertical-tabs.html.twig index 5b7298b..5db74a5 100644 --- a/core/modules/system/templates/vertical-tabs.html.twig +++ b/core/modules/system/templates/vertical-tabs.html.twig @@ -12,4 +12,4 @@ * @ingroup themeable */ #} -
{{ children }}
+
{{ children|raw }}
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermIndexTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermIndexTest.php index e79d159..dbe121c 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermIndexTest.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermIndexTest.php @@ -215,6 +215,6 @@ function testTaxonomyTermHierarchyBreadcrumbs() { // Verify that the page breadcrumbs include a link to the parent term. $this->drupalGet('taxonomy/term/' . $term1->id()); - $this->assertRaw(l($term2->getName(), 'taxonomy/term/' . $term2->id()), 'Parent term link is displayed when viewing the node.'); + $this->assertRaw((string) l($term2->getName(), 'taxonomy/term/' . $term2->id()), 'Parent term link is displayed when viewing the node.'); } } diff --git a/core/modules/update/lib/Drupal/update/Tests/UpdateContribTest.php b/core/modules/update/lib/Drupal/update/Tests/UpdateContribTest.php index 25d8233..dd6a372 100644 --- a/core/modules/update/lib/Drupal/update/Tests/UpdateContribTest.php +++ b/core/modules/update/lib/Drupal/update/Tests/UpdateContribTest.php @@ -55,7 +55,7 @@ function testNoReleasesAvailable() { // Cannot use $this->standardTests() because we need to check for the // 'No available releases found' string. $this->assertRaw('

' . t('Drupal core') . '

'); - $this->assertRaw(l(t('Drupal'), 'http://example.com/project/drupal')); + $this->assertRaw((string) l(t('Drupal'), 'http://example.com/project/drupal')); $this->assertText(t('Up to date')); $this->assertRaw('

' . t('Modules') . '

'); $this->assertNoText(t('Update available')); @@ -88,7 +88,7 @@ function testUpdateContribBasic() { $this->assertText(t('Up to date')); $this->assertRaw('

' . t('Modules') . '

'); $this->assertNoText(t('Update available')); - $this->assertRaw(l(t('AAA Update test'), 'http://example.com/project/aaa_update_test'), 'Link to aaa_update_test project appears.'); + $this->assertRaw((string) l(t('AAA Update test'), 'http://example.com/project/aaa_update_test'), 'Link to aaa_update_test project appears.'); } /** @@ -151,8 +151,8 @@ function testUpdateContribOrder() { // its own project on the report. $this->assertNoRaw(l(t('AAA Update test'), 'http://example.com/project/aaa_update_test'), 'Link to aaa_update_test project does not appear.'); // The other two should be listed as projects. - $this->assertRaw(l(t('BBB Update test'), 'http://example.com/project/bbb_update_test'), 'Link to bbb_update_test project appears.'); - $this->assertRaw(l(t('CCC Update test'), 'http://example.com/project/ccc_update_test'), 'Link to bbb_update_test project appears.'); + $this->assertRaw((string) l(t('BBB Update test'), 'http://example.com/project/bbb_update_test'), 'Link to bbb_update_test project appears.'); + $this->assertRaw((string) l(t('CCC Update test'), 'http://example.com/project/ccc_update_test'), 'Link to bbb_update_test project appears.'); // We want to make sure we see the BBB project before the CCC project. // Instead of just searching for 'BBB Update test' or something, we want @@ -197,7 +197,7 @@ function testUpdateBaseThemeSecurityUpdate() { ); $this->refreshUpdateStatus($xml_mapping); $this->assertText(t('Security update required!')); - $this->assertRaw(l(t('Update test base theme'), 'http://example.com/project/update_test_basetheme'), 'Link to the Update test base theme project appears.'); + $this->assertRaw((string) l(t('Update test base theme'), 'http://example.com/project/update_test_basetheme'), 'Link to the Update test base theme project appears.'); } /** @@ -346,9 +346,9 @@ function testUpdateBrokenFetchURL() { $this->assertUniqueText(t('Failed to get available update data for one project.')); // The other two should be listed as projects. - $this->assertRaw(l(t('AAA Update test'), 'http://example.com/project/aaa_update_test'), 'Link to aaa_update_test project appears.'); + $this->assertRaw((string) l(t('AAA Update test'), 'http://example.com/project/aaa_update_test'), 'Link to aaa_update_test project appears.'); $this->assertNoRaw(l(t('BBB Update test'), 'http://example.com/project/bbb_update_test'), 'Link to bbb_update_test project does not appear.'); - $this->assertRaw(l(t('CCC Update test'), 'http://example.com/project/ccc_update_test'), 'Link to bbb_update_test project appears.'); + $this->assertRaw((string) l(t('CCC Update test'), 'http://example.com/project/ccc_update_test'), 'Link to bbb_update_test project appears.'); } /** @@ -390,7 +390,7 @@ function testHookUpdateStatusAlter() { $this->drupalGet('admin/reports/updates'); $this->assertRaw('

' . t('Modules') . '

'); $this->assertText(t('Security update required!')); - $this->assertRaw(l(t('AAA Update test'), 'http://example.com/project/aaa_update_test'), 'Link to aaa_update_test project appears.'); + $this->assertRaw((string) l(t('AAA Update test'), 'http://example.com/project/aaa_update_test'), 'Link to aaa_update_test project appears.'); // Visit the reports page again without the altering and make sure the // status is back to normal. @@ -398,7 +398,7 @@ function testHookUpdateStatusAlter() { $this->drupalGet('admin/reports/updates'); $this->assertRaw('

' . t('Modules') . '

'); $this->assertNoText(t('Security update required!')); - $this->assertRaw(l(t('AAA Update test'), 'http://example.com/project/aaa_update_test'), 'Link to aaa_update_test project appears.'); + $this->assertRaw((string) l(t('AAA Update test'), 'http://example.com/project/aaa_update_test'), 'Link to aaa_update_test project appears.'); // Turn the altering back on and visit the Update manager UI. $update_test_config->set('update_status', $update_status)->save(); diff --git a/core/modules/update/lib/Drupal/update/Tests/UpdateCoreTest.php b/core/modules/update/lib/Drupal/update/Tests/UpdateCoreTest.php index 7928455..0b26ebc 100644 --- a/core/modules/update/lib/Drupal/update/Tests/UpdateCoreTest.php +++ b/core/modules/update/lib/Drupal/update/Tests/UpdateCoreTest.php @@ -56,9 +56,9 @@ function testNormalUpdateAvailable() { $this->assertNoText(t('Up to date')); $this->assertText(t('Update available')); $this->assertNoText(t('Security update required!')); - $this->assertRaw(l('7.1', 'http://example.com/drupal-7-1-release'), 'Link to release appears.'); - $this->assertRaw(l(t('Download'), 'http://example.com/drupal-7-1.tar.gz'), 'Link to download appears.'); - $this->assertRaw(l(t('Release notes'), 'http://example.com/drupal-7-1-release'), 'Link to release notes appears.'); + $this->assertRaw((string) l('7.1', 'http://example.com/drupal-7-1-release'), 'Link to release appears.'); + $this->assertRaw((string) l(t('Download'), 'http://example.com/drupal-7-1.tar.gz'), 'Link to download appears.'); + $this->assertRaw((string) l(t('Release notes'), 'http://example.com/drupal-7-1-release'), 'Link to release notes appears.'); } /** @@ -71,9 +71,9 @@ function testSecurityUpdateAvailable() { $this->assertNoText(t('Up to date')); $this->assertNoText(t('Update available')); $this->assertText(t('Security update required!')); - $this->assertRaw(l('7.2', 'http://example.com/drupal-7-2-release'), 'Link to release appears.'); - $this->assertRaw(l(t('Download'), 'http://example.com/drupal-7-2.tar.gz'), 'Link to download appears.'); - $this->assertRaw(l(t('Release notes'), 'http://example.com/drupal-7-2-release'), 'Link to release notes appears.'); + $this->assertRaw((string) l('7.2', 'http://example.com/drupal-7-2-release'), 'Link to release appears.'); + $this->assertRaw((string) l(t('Download'), 'http://example.com/drupal-7-2.tar.gz'), 'Link to download appears.'); + $this->assertRaw((string) l(t('Release notes'), 'http://example.com/drupal-7-2-release'), 'Link to release notes appears.'); } /** diff --git a/core/modules/update/lib/Drupal/update/Tests/UpdateTestBase.php b/core/modules/update/lib/Drupal/update/Tests/UpdateTestBase.php index 47a6649..5c09710 100644 --- a/core/modules/update/lib/Drupal/update/Tests/UpdateTestBase.php +++ b/core/modules/update/lib/Drupal/update/Tests/UpdateTestBase.php @@ -55,7 +55,7 @@ protected function refreshUpdateStatus($xml_map, $url = 'update-test') { */ protected function standardTests() { $this->assertRaw('

' . t('Drupal core') . '

'); - $this->assertRaw(l(t('Drupal'), 'http://example.com/project/drupal'), 'Link to the Drupal project appears.'); + $this->assertRaw((string) l(t('Drupal'), 'http://example.com/project/drupal'), 'Link to the Drupal project appears.'); $this->assertNoText(t('No available releases found')); } } diff --git a/core/modules/views/templates/views-view-grid.html.twig b/core/modules/views/templates/views-view-grid.html.twig index a5a813c..bfadb8e 100644 --- a/core/modules/views/templates/views-view-grid.html.twig +++ b/core/modules/views/templates/views-view-grid.html.twig @@ -31,7 +31,7 @@ {% for column in row.content %} - {{ column.content }} + {{ column.content|raw }} {% endfor %} @@ -41,7 +41,7 @@ {% for row in column.content %} - {{ row.content }} + {{ row.content|raw }} {% endfor %} diff --git a/core/modules/views/templates/views-view-table.html.twig b/core/modules/views/templates/views-view-table.html.twig index 6b0b26c..7b1f280 100644 --- a/core/modules/views/templates/views-view-table.html.twig +++ b/core/modules/views/templates/views-view-table.html.twig @@ -51,7 +51,7 @@ {% for column in header %} - {{ column.content }} + {{ column.content|raw }} {% endfor %} @@ -62,7 +62,7 @@ {% for column in row.columns %} - {{ column.content }} + {{ column.content|raw }} {% endfor %} diff --git a/core/modules/views_ui/templates/views-ui-container.html.twig b/core/modules/views_ui/templates/views-ui-container.html.twig index d45b158..3010a6c 100644 --- a/core/modules/views_ui/templates/views-ui-container.html.twig +++ b/core/modules/views_ui/templates/views-ui-container.html.twig @@ -12,4 +12,4 @@ * @ingroup themeable */ #} -{{ children }} +{{ children|raw }} diff --git a/core/modules/views_ui/templates/views-ui-display-tab-setting.html.twig b/core/modules/views_ui/templates/views-ui-display-tab-setting.html.twig index 1c67469..9dc0cfd 100644 --- a/core/modules/views_ui/templates/views-ui-display-tab-setting.html.twig +++ b/core/modules/views_ui/templates/views-ui-display-tab-setting.html.twig @@ -20,6 +20,6 @@ {{ description }} {%- endif %} {% if settings_links %} - {{ settings_links|join(' | ') }} + {{ settings_links|join(' | ')|raw }} {% endif %} diff --git a/core/modules/views_ui/views_ui.theme.inc b/core/modules/views_ui/views_ui.theme.inc index 430f14a..9d1f07a 100644 --- a/core/modules/views_ui/views_ui.theme.inc +++ b/core/modules/views_ui/views_ui.theme.inc @@ -7,6 +7,7 @@ use Drupal\Core\Render\Element; use Drupal\Core\Template\Attribute; +use Drupal\Core\Template\Markup; /** * Prepares variables for Views UI display tab setting templates. @@ -72,7 +73,7 @@ function template_preprocess_views_ui_display_tab_bucket(&$variables) { $variables['attributes']['title'][] = t('Overridden'); } - $variables['content'] = $element['#children']; + $variables['content'] = new Markup($element['#children']); $variables['title'] = $element['#title']; $variables['actions'] = !empty($element['#actions']) ? $element['#actions'] : array(); } diff --git a/core/themes/bartik/templates/comment.html.twig b/core/themes/bartik/templates/comment.html.twig index d2c4584..88e1db4 100644 --- a/core/themes/bartik/templates/comment.html.twig +++ b/core/themes/bartik/templates/comment.html.twig @@ -66,17 +66,17 @@
- {{ user_picture }} + {{ user_picture|raw }}
diff --git a/core/themes/engines/twig/twig.engine b/core/themes/engines/twig/twig.engine index 1595bf8..e5847cc 100644 --- a/core/themes/engines/twig/twig.engine +++ b/core/themes/engines/twig/twig.engine @@ -6,6 +6,7 @@ */ use Drupal\Core\Extension\Extension; +use Drupal\Core\Template\Markup; /** * Implements hook_theme(). @@ -138,7 +139,7 @@ function twig_render_var($arg) { if (is_object($arg)) { if (method_exists($arg, '__toString')) { - return (string) $arg; + return new $arg; } throw new Exception(t('Object of type "@class" cannot be printed.', array('@class' => get_class($arg)))); }