Hello together,
currently I’m working on exposing a JSON object holding the rendered content of the nodes to an API. So far I’ve created a new package with a hook on the event afterNodePublishing where I can access my document.
class Package extends BasePackage
{
/**
* @param Bootstrap $bootstrap The current bootstrap
*/
public function boot(Bootstrap $bootstrap)
{
$dispatcher = $bootstrap->getSignalSlotDispatcher();
$dispatcher->connect(Workspace::class, 'afterNodePublishing', Publisher::class, 'createExportJSON');
}
}
I can access the node’s properties per FlowQuery within my function createExportJSON, but I’ve yet to figure out how to access the whole rendered node.
public function createExportJSON (NodeInterface $node): void
{
$query = new FlowQuery([$node]);
$title = $query->property('headline');
}
What I get here is the headline of my document as a simple string, but what I need is the whole HTML which is provided by Fusion. So basically the HTML within the afx here:
renderer = afx`
<h2 class="inf-no-margin">
<span class="inf-headline inf-headline--large--thin inf-block inf-no-margin">{props.headline}</span>
</h2>
`
How can I achieve this?