Problem/Motivation
Renderer::render() can throw a LogicException that says:
Render context is empty, because render() was called outside of a renderRoot() or renderPlain() call. Use renderPlain()/renderRoot() or #lazy_builder/#pre_render instead.
But renderPlain() is deprecated since #2511308: Rename RendererInterface::renderPlain() to ::renderInIsolation().
Steps to reproduce
This exception can easily be triggered with Drush:
drush ev '$build = []; \\Drupal::service(\'renderer\')->render($build);'
Proposed resolution
The exception message should tell people to use renderInIsolation() instead.
Remaining tasks
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
Issue fork drupal-3573953
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
prudloff commentedComment #3
prudloff commentedComment #6
sujal kshatri commentedHello,
Replaced renderPlain() with renderInIsolation() in Renderer exception message
Comment #7
sujal kshatri commentedComment #8
sivaji_ganesh_jojodae commentedThe merge request looks good to me. I don’t see any issues with the proposed changes.
Comment #9
sivaji_ganesh_jojodae commentedComment #10
smustgrave commentedDoing some cleanup this doesn't need to reference any of that. The issue linked in #3 is enough.
MR is straight forward enough nice work @sujal kshatri
Comment #14
longwaveBackported down to 11.3.x as exception messages are not translatable strings. Appears to already be applied to 10.6.x? Either way not really worth any more work there.
Committed and pushed 5fa1ac80f9e to main and 4ef94500825 to 11.x and 5af44d4ad0e to 11.3.x. Thanks!