core/lib/Drupal/Core/Controller/HtmlController.php | 28 ++++++++++------------
.../Drupal/Core/Render/BareHtmlPageRenderer.php | 4 ++--
2 files changed, 14 insertions(+), 18 deletions(-)
diff --git a/core/lib/Drupal/Core/Controller/HtmlController.php b/core/lib/Drupal/Core/Controller/HtmlController.php
index 27f3bb9..5171635 100644
--- a/core/lib/Drupal/Core/Controller/HtmlController.php
+++ b/core/lib/Drupal/Core/Controller/HtmlController.php
@@ -167,26 +167,22 @@ public function renderMainContent(array $page, $title, array $custom) {
// page.html.twig, hence add them here, just before rendering html.html.twig.
static::buildPageTopAndBottom($html);
- // The three parts of rendered markup on a page (page_top, page and
- // page_bottom) must be rendered with $is_root_call = TRUE, so that their
- // #post_render_cache callbacks have been executed and their #attached
- // assets have been bubbled.
- // html.html.twig, we must not perform #post_render_cache callbacks anymore,
- // because we must be able to generate the list of all the assets for the
- // rendered page.
- drupal_render($html['page'], TRUE);
+ // The three parts of rendered markup in html.html.twig (page_top, page and
+ // page_bottom) must be rendered with drupal_render_root(), so that their
+ // #post_render_cache callbacks are executed (which may attach additional
+ // assets).
+ // html.html.twig must be able to render the final list of attached assets,
+ // and hence may not execute any #post_render_cache_callbacks (because they
+ // might add yet more assets to be attached), and therefore it must be
+ // rendered with drupal_render(), not drupal_render_root().
+ drupal_render_root($html['page']);
if (isset($html['page_top'])) {
- drupal_render($html['page_top'], TRUE);
+ drupal_render_root($html['page_top']);
}
if (isset($html['page_bottom'])) {
- drupal_render($html['page_bottom'], TRUE);
+ drupal_render_root($html['page_bottom']);
}
-
- // The three parts of rendered markup on a page (page_top, page and
- // page_bottom) have already been rendered. Rendering the html.html.twig
- // template may only do "simple" rendering, without any bubbling, because we
- // must be able to generate the list of all the assets for the rendered page.
- $content = drupal_render($html, FALSE);
+ $content = drupal_render_root($html);
// Store the cache tags associated with this page in a X-Drupal-Cache-Tags
// header. Also associate the "rendered" cache tag. This allows us to
diff --git a/core/lib/Drupal/Core/Render/BareHtmlPageRenderer.php b/core/lib/Drupal/Core/Render/BareHtmlPageRenderer.php
index 19fece6..5ec957e 100644
--- a/core/lib/Drupal/Core/Render/BareHtmlPageRenderer.php
+++ b/core/lib/Drupal/Core/Render/BareHtmlPageRenderer.php
@@ -71,8 +71,8 @@ protected function renderBarePage(array $content, $title, array $page_additions,
// We must first render the contents of the html.html.twig template, see
// \Drupal\Core\Controller\HtmlController::renderPage() for details.
- drupal_render($html['page'], TRUE);
- return drupal_render($html, FALSE);
+ drupal_render_root($html['page']);
+ return drupal_render($html);
}
}