I am trying to generate html output of whole page and then pass it to response array.I am doing something like this:
$page = array(
'#theme' => 'html',
'#page_object' => new HtmlPage(render($content)),
);
$content
is a render array and new HtmlPage creates a HtmlPage object from an existing page. I am passing render($page)
to the response object, but I am getting error this error:
LogicException: A stray
drupal_render()
invocation with$is_root_call = TRUE
is causing bubbling of attached assets to break. inDrupal\Core\Render\Renderer->doRender()
(line 377 of core\lib\Drupal\Core\Render\Renderer.php).
What should I do to make this correct? Thanks
'#page_object' => render($content),
with'#page' => render($content),
render()
.render()
ordrupal_render()
," but that is not much helpful.