diff --git a/core/lib/Drupal/Core/Template/TwigEnvironment.php b/core/lib/Drupal/Core/Template/TwigEnvironment.php index 9225712..0af48ce 100644 --- a/core/lib/Drupal/Core/Template/TwigEnvironment.php +++ b/core/lib/Drupal/Core/Template/TwigEnvironment.php @@ -7,6 +7,7 @@ namespace Drupal\Core\Template; +use Drupal\Component\Utility\SafeMarkup; use Drupal\Core\PhpStorage\PhpStorageFactory; /** @@ -201,7 +202,9 @@ public function getTemplateClass($name, $index = NULL) { public function renderInline($template_string, array $context = array()) { // Prefix all inline templates with a special comment. $template_string = '{# inline_template_start #}' . $template_string; - return $this->loadTemplate($template_string, NULL)->render($context); + // @todo replace with object implementating SafeStringInterface in + // https://www.drupal.org/node/2506581. + return SafeMarkup::set($this->loadTemplate($template_string, NULL)->render($context)); } } diff --git a/core/modules/system/src/Tests/Theme/TwigEnvironmentTest.php b/core/modules/system/src/Tests/Theme/TwigEnvironmentTest.php index b5450df..235db35 100644 --- a/core/modules/system/src/Tests/Theme/TwigEnvironmentTest.php +++ b/core/modules/system/src/Tests/Theme/TwigEnvironmentTest.php @@ -41,10 +41,10 @@ public function testInlineTemplate() { $unsafe_string = ''; $element['test'] = array( '#type' => 'inline_template', - '#template' => 'test-with-context {{ unsafe_content }}', + '#template' => 'test-with-context ', '#context' => array('unsafe_content' => $unsafe_string), ); - $this->assertEqual($renderer->renderRoot($element), 'test-with-context ' . SafeMarkup::checkPlain($unsafe_string)); + $this->assertEqual($renderer->renderRoot($element), 'test-with-context '); // Enable twig_auto_reload and twig_debug. $settings = Settings::getAll(); diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc index 484536c..1141a35 100644 --- a/core/modules/system/system.admin.inc +++ b/core/modules/system/system.admin.inc @@ -323,13 +323,11 @@ function theme_system_modules_uninstall($variables) { $rows[] = array( array('data' => drupal_render($form['uninstall'][$module]), 'align' => 'center'), array( - 'data' => SafeMarkup::format( - '', - array( - '@module_id' => $form['uninstall'][$module]['#id'], - '@module_name' => drupal_render($form['modules'][$module]['name']), - ) - ), + 'data' => array( + '#type' => 'inline_template', + '#template' => '', + '#context' => array('module_id' => $form['uninstall'][$module]['#id'], 'module_name' => drupal_render($form['modules'][$module]['name'])), + ) ), array( 'data' => array(