diff --git a/core/lib/Drupal/Core/Theme/ThemeManager.php b/core/lib/Drupal/Core/Theme/ThemeManager.php index e04631a..b02af34 100644 --- a/core/lib/Drupal/Core/Theme/ThemeManager.php +++ b/core/lib/Drupal/Core/Theme/ThemeManager.php @@ -7,6 +7,7 @@ namespace Drupal\Core\Theme; +use Drupal\Core\Render\SafeString; use Drupal\Core\Routing\RouteMatchInterface; use Drupal\Core\Routing\StackedRouteMatchInterface; use Symfony\Component\HttpFoundation\RequestStack; @@ -396,7 +397,7 @@ protected function theme($hook, $variables = array()) { $output = $render_function($template_file, $variables); } - return ($output instanceof \Twig_Markup) ? $output : (string) $output; + return ($output instanceof SafeString) ? $output : (string) $output; } /** diff --git a/core/themes/engines/twig/twig.engine b/core/themes/engines/twig/twig.engine index 35cfe25..7f8e6eb 100644 --- a/core/themes/engines/twig/twig.engine +++ b/core/themes/engines/twig/twig.engine @@ -6,6 +6,7 @@ */ use Drupal\Component\Utility\SafeMarkup; +use Drupal\Core\Render\SafeString; use Drupal\Core\Extension\Extension; /** @@ -74,7 +75,7 @@ function twig_render_template($template_file, array $variables) { } if ($twig_service->isDebug()) { $output['debug_prefix'] .= "\n\n"; - $output['debug_prefix'] .= "\n"; + $output['debug_prefix'] .= "\n"; // If there are theme suggestions, reverse the array so more specific // suggestions are shown first. if (!empty($variables['theme_hook_suggestions'])) { @@ -108,13 +109,13 @@ function twig_render_template($template_file, array $variables) { $prefix = ($template == $current_template) ? 'x' : '*'; $suggestion = $prefix . ' ' . $template; } - $output['debug_info'] .= "\n"; + $output['debug_info'] .= "\n"; } - $output['debug_info'] .= "\n\n"; - $output['debug_suffix'] .= "\n\n\n"; + $output['debug_info'] .= "\n\n"; + $output['debug_suffix'] .= "\n\n\n"; } // This output has already been rendered and is therefore considered safe. - return new \Twig_Markup(implode('', $output), 'UTF-8'); + return SafeString::create(implode('', $output)); } /**