Problem/Motivation
While rendering something in a post render callback, it is possible that this results in new post render callbacks that need to be processed.
Right now, they are added to the stack and there's a no-op operation that merges them together but nothing happens to them.
Specific example:
A poll rendered through entity_embed, both use post render callbacks for their output.
Proposed resolution
A do/while (yay!) loop around the relevant lines of code in Renderer, so that it we keep processing them until there are none left.
Remaining tasks
User interface changes
API changes
None, drupal_render() inside a post render callback works as expected again.
Comments
Comment #1
berdirFirst patch. This worked for my specific use case, did not check if it affected something else.
Will also need a comment to explain this.
Comment #3
wim leersComment #4
fabianx commentedNice! Exactly what we need, it is major though.
I would RTBC, but there are some pesky test failures and we need more test coverage ...
Comment #5
wim leers:)
The test failures were due to the fact that in HEAD, the executed
#post_render_cachemetadata is left in place, and the existing tests very meticulously testing that metadata. With the proposed patch, that capability is explicitly removed. Hence the test failures.Adjusted the tests, now they pass.
Comment #6
fabianx commentedAnd RTBC :).
Comment #7
alexpottDo you want the assertion message or not? :)
Comment #8
wim leersD'oh! That's a test debugging technique I use; I didn't mean to remove the assertion message :)
Fun fact: I found this in two more places in
RenderTest, even though it wasn't being introduced by this patch… rectifying those too.Also: this needed a reroll anyway since #2382503: Not possible to render self-contained render array while a render stack is active landed.
Comment #9
catchCommitted/pushed to 8.0.x, thanks!
Comment #12
wim leersA related issue was just opened: #2470715: cacheGet-case: #post_render_callback's that result from other #post_render_calback are not processed .