diff --git a/core/lib/Drupal/Core/Render/Renderer.php b/core/lib/Drupal/Core/Render/Renderer.php index 373a0be..286eec1 100644 --- a/core/lib/Drupal/Core/Render/Renderer.php +++ b/core/lib/Drupal/Core/Render/Renderer.php @@ -289,19 +289,20 @@ public function render(&$elements, $is_root_call = FALSE) { $elements['#children'] = call_user_func($callable, $elements['#children'], $elements); } } - // We store the resulting output in $elements['#markup'], to be consistent // with how render cached output gets stored. This ensures that // #post_render_cache callbacks get 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']) ? SafeMarkup::checkAdminXss($elements['#prefix']) : ''; - $suffix = isset($elements['#suffix']) ? SafeMarkup::checkAdminXss($elements['#suffix']) : ''; - - $elements['#markup'] = $prefix . $elements['#children'] . $suffix; - - // We've rendered this element (and its subtree!), now update the stack. + // Added if elements are alredy esixts else creating new element appends prefix and suffix + if (isset($elements['#render_children'])) { + $elements['#markup'] = $elements['#children']; + } + else { + $prefix = isset($elements['#prefix']) ? SafeMarkup::checkAdminXss($elements['#prefix']) : ''; + $suffix = isset($elements['#suffix']) ? SafeMarkup::checkAdminXss($elements['#suffix']) : ''; + $elements['#markup'] = $prefix . $elements['#children'] . $suffix; + } $this->updateStack($elements); - // Cache the processed element if #cache is set. if (isset($elements['#cache'])) { drupal_render_cache_set($elements['#markup'], $elements); @@ -310,7 +311,6 @@ public function render(&$elements, $is_root_call = FALSE) { // Only when we're in a root (non-recursive) drupal_render() call, // #post_render_cache callbacks must be executed, to prevent breaking the // render cache in case of nested elements with #cache set. - // // By running them here, we ensure that: // - they run when #cache is disabled, // - they run when #cache is enabled and there is a cache miss.