I am currently working on a JSON API so my PHP Controller is using the JsonView. As one part of the JSON I need to return the rendered HTML of a Fusion Object. Unfortunately I haven’t found a solution to really render only a single Fusion Object.
Can you point to an example how to render a single Fusion objects regardless of a site node?
Prior I would have use Fluid but I really want to get rid of it in Neos CMS.
Thank you for answering, Marc!
Your code snippet assumes that I am using the FusionView::class. My whole controller is using JsonView::class and therefore no configured fusion view is available. Is it possible to render the fusion objects in a limited scope of an method?
Its more like “render me this fusion object (which is not doing any special stuff and just place variables in a HTML structure) and return the HTML so I can use it further on in my PHP controller”?
for that you have to create another \Neos\Fusion\View\FusionView where you have to set the fusion files manually to be included. This can be done like this: (but you can also look into the $supportedOptions variable and read into it yourself ;))
Unfortunately I have to set a link to a node now but the FusionView is missing a documentNode to refer to. All <a>-Tags are generated but with an empty href-attribute.
Do you or someone else know how to properly generate a documentNode so the FusionView is able to generate links?