core/lib/Drupal/Core/Render/Renderer.php | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/core/lib/Drupal/Core/Render/Renderer.php b/core/lib/Drupal/Core/Render/Renderer.php index 4dd1dba..946d940 100644 --- a/core/lib/Drupal/Core/Render/Renderer.php +++ b/core/lib/Drupal/Core/Render/Renderer.php @@ -509,19 +509,15 @@ protected function doRender(&$elements, $is_root_call = FALSE) { // Only apply the prefix and suffix markup around the children if they have // not already been rendered by the theme manager. - if (!isset($elements['#render_children'])) { - // We store the resulting output in $elements['#markup'], to be - // consistent with how render cached output gets stored. This ensures that - // placeholder replacement logic gets the same data to work with, no - // matter if #cache is disabled, #cache is enabled, there is a cache hit - // or miss. - $prefix = isset($elements['#prefix']) ? $this->xssFilterAdminIfUnsafe($elements['#prefix']) : ''; - $suffix = isset($elements['#suffix']) ? $this->xssFilterAdminIfUnsafe($elements['#suffix']) : ''; - $elements['#markup'] = Markup::create($prefix . $elements['#children'] . $suffix); - } - else { - $elements['#markup'] = Markup::create($elements['#children']); - } + $prefix = !isset($elements['#render_children']) && isset($elements['#prefix']) ? $this->xssFilterAdminIfUnsafe($elements['#prefix']) : ''; + $suffix = !isset($elements['#render_children']) && isset($elements['#suffix']) ? $this->xssFilterAdminIfUnsafe($elements['#suffix']) : ''; + + // We store the resulting output in $elements['#markup'], to be consistent + // with how render cached output gets stored. This ensures that placeholder + // replacement logic gets the same data to work with, no matter if #cache is + // disabled, #cache is enabled, there is a cache hit or miss. + $elements['#markup'] = Markup::create($prefix . $elements['#children'] . $suffix); + // We've rendered this element (and its subtree!), now update the context. $context->update($elements);