diff --git a/core/includes/theme.inc b/core/includes/theme.inc index 0e25e63..bba47f6 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -360,11 +360,14 @@ function theme_get_setting($setting_name, $theme = NULL) { } /** - * Helper function to automatically escape variables in theme functions. + * Automatically escapes variables in theme functions. * - * You use this method in theme functions to ensure that the result is safe for + * This method is used in theme functions to ensure that the result is safe for * output inside HTML fragments. - * This mimics the behavior of the auto-escape fucntionality in Twig. + * This mimics the behavior of the auto-escape functionality in Twig. + * + * Note: This function should be kept in sync with + * \Drupal\Core\Template\TwigExtension::escapeFilter * * @param mixed $arg * The string, object, or render array to escape if needed. @@ -376,6 +379,8 @@ function theme_get_setting($setting_name, $theme = NULL) { * Thrown when an object is passed in which cannot be printed. * * @see \Drupal\Core\Template\TwigExtension::escapeFilter() + * + * @deprecate */ function theme_escape_and_render($arg) { if ($arg instanceOf SafeStringInterface) { diff --git a/core/lib/Drupal/Core/Template/TwigExtension.php b/core/lib/Drupal/Core/Template/TwigExtension.php index 735a434..60886b7 100644 --- a/core/lib/Drupal/Core/Template/TwigExtension.php +++ b/core/lib/Drupal/Core/Template/TwigExtension.php @@ -350,6 +350,8 @@ public function escapePlaceholder($env, $string) { * * Replacement function for Twig's escape filter. * + * Note: This function should be kept in sync with theme_escape_and_render(). + * * @param \Twig_Environment $env * A Twig_Environment instance. * @param mixed $arg diff --git a/core/tests/Drupal/KernelTests/Core/Theme/ThemeAutoescapeTest.php b/core/tests/Drupal/KernelTests/Core/Theme/ThemeAutoescapeTest.php index f015e57..3f28f39 100644 --- a/core/tests/Drupal/KernelTests/Core/Theme/ThemeAutoescapeTest.php +++ b/core/tests/Drupal/KernelTests/Core/Theme/ThemeAutoescapeTest.php @@ -11,7 +11,6 @@ use Drupal\Core\Link; use Drupal\Core\Render\RenderContext; use Drupal\Core\Render\SafeString; -use Drupal\Core\Url; use Drupal\KernelTests\KernelTestBase; /**