diff --git a/core/lib/Drupal/Core/Theme/ThemeManager.php b/core/lib/Drupal/Core/Theme/ThemeManager.php index 122bc6d..7add727 100644 --- a/core/lib/Drupal/Core/Theme/ThemeManager.php +++ b/core/lib/Drupal/Core/Theme/ThemeManager.php @@ -318,7 +318,10 @@ public function render($hook, array $variables) { $output = ''; if (isset($info['function'])) { if (function_exists($info['function'])) { - $output = SafeMarkup::set($info['function']($variables)); + // Theme functions do not render via the theme engine, so the output + // is not autoescaped. However, we can only presume that the theme + // function has been written correctly and that the markup is safe. + $output = SafeString::create($info['function']($variables)); } } else { diff --git a/core/lib/Drupal/Core/Theme/ThemeManagerInterface.php b/core/lib/Drupal/Core/Theme/ThemeManagerInterface.php index ebbfcb5..b61ff84 100644 --- a/core/lib/Drupal/Core/Theme/ThemeManagerInterface.php +++ b/core/lib/Drupal/Core/Theme/ThemeManagerInterface.php @@ -26,8 +26,8 @@ * @param array $variables * An associative array of theme variables. * - * @return string - * The rendered output. + * @return string|\Drupal\Component\Utility\SafeStringInterface + * The rendered output, or a SafeString object. */ public function render($hook, array $variables);