A direct call to Renderer::render(), at least when RenderItemTest::testPreprocessIndexItems() runs throws:-
\LogicException When called outside of a render context. (i.e. outside of a renderRoot(), renderPlain() or executeInRenderContext() call.)
Call is made in RenderedItem::preprocessIndexItems(). Guessing swapping for ::renderPlain() is going to be appropriate for a value being preprocessed for the index. Patch to follow.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | call_to-2529990-5.patch | 612 bytes | bjaxelsen |
| #1 | 2529990-01-call_to_render_render.patch | 664 bytes | ekes |
Comments
Comment #1
ekes commentedClears exception and this tests passes.
See: #2529036: Form validate() to formValidate(), leads to fatal error on index creation for clearing other test fails.
Comment #2
drunken monkeyThe documentation could be in Chinese for all I understand of it, but if it fixes the issue, sure. Committed.
Thanks a lot for the patch!
Comment #5
bjaxelsen commentedUsing the renderPlain() method causes a problem when you have references entities. I have a Paragraphs field and the contents of this field does not get rendered. I think it works to use renderRoot() instead.
Comment #6
drunken monkeyAre you completely sure about that? There is nothing in the documentation that suggests this and looking at the code I also see almost no possible way that the two could have different results.
Finally, it seems calling
renderRoot()will throw an exception when called from inside anotherrenderRoot()call, so this will potentially also fail completely in some situations.Please debug more to find out a) if there really is a difference, and why/how, and b) what a better fix would be. Then please create a new issue.