diff --git a/core/modules/views/src/Plugin/views/PluginBase.php b/core/modules/views/src/Plugin/views/PluginBase.php index 9f6b860..2fe69dc 100644 --- a/core/modules/views/src/Plugin/views/PluginBase.php +++ b/core/modules/views/src/Plugin/views/PluginBase.php @@ -379,16 +379,16 @@ protected function viewsTokenReplace($text, $tokens) { // Rename the token keys so they are valid twig variable names. $vars = []; foreach ($twig_tokens as $token => $value) { - $vars[str_replace('-', '__', $token)] = $value; + $new_token = str_replace('-', '__', $token); + $vars[$new_token] = $value; + $text = str_replace($token, $new_token, $text); } // Use the unfiltered text for the Twig template, then filter the output. // Otherwise, Xss::filterAdmin could remove valid Twig syntax before the // template is parsed. $build = array( '#type' => 'inline_template', - '#template' => array_walk($twig_tokens, function($token, $value, $text){ - str_replace($token, str_replace('-', '__', $token), $text); - }, $text), + '#template' => $text, '#context' => $vars, '#post_render' => [ function ($children, $elements) {