diff --git a/core/modules/views/src/Plugin/views/PluginBase.php b/core/modules/views/src/Plugin/views/PluginBase.php index 836f5dd..e56dcae 100644 --- a/core/modules/views/src/Plugin/views/PluginBase.php +++ b/core/modules/views/src/Plugin/views/PluginBase.php @@ -390,7 +390,7 @@ function ($children, $elements) { ], ); - return (string) $this->getRenderer()->renderPlain($build); + return (string) $this->getRenderer()->render($build); } else { return $text; diff --git a/core/modules/views/src/Tests/Plugin/PluginBaseTest.php b/core/modules/views/src/Tests/Plugin/PluginBaseTest.php index ac61d80..faa736f 100644 --- a/core/modules/views/src/Tests/Plugin/PluginBaseTest.php +++ b/core/modules/views/src/Tests/Plugin/PluginBaseTest.php @@ -7,6 +7,7 @@ namespace Drupal\views\Tests\Plugin { + use Drupal\Core\Render\RenderContext; use Drupal\Core\Render\SafeString; use Drupal\simpletest\KernelTestBase; use Drupal\views\Plugin\views\TestPluginBase; @@ -35,7 +36,11 @@ public function testViewsTokenReplace() { $text = '{{ langcode__value }} means {{ langcode }}'; $tokens = [ '{{ langcode }}' => SafeString::create('English'), '{{ langcode__value }}' => 'en']; - $result = $this->testPluginBase->viewsTokenReplace($text, $tokens); + + $result = \Drupal::service('renderer')->executeInRenderContext(new RenderContext(), function () use ($text, $tokens) { + return $this->testPluginBase->viewsTokenReplace($text, $tokens); + }); + $this->assertIdentical($result, 'en means English'); }