How to render conditional parent tags depending on a Fusion property?

Hello,

I would like to render following html:

<div class="row">
  <div class="col">
    <div class="my-component">...</div>
  </div>
</div>

The two div elements should only render if some parent Fusion object sets a specific property, e.g. “renderWithRow=true” while including this Fusion object. The html code inside the “my-component” div should also be centralized so that I don’t need to copy&paste it.

How to achieve this in a best practice way? Is using the Neos.Fusion:Case Fusion object the way to go or https://docs.neos.io/cms/tutorials/changing-defaults-depending-on-content-placement-1?

Thanks for your inputs!

You can apply a process that wrap the element and the process object can itself be a Fusion component.

sth like this should work (untested)

content = afx`
  <div class="col">
    <div class="my-component">...</div>
  </div>
`
content.@process.wrapRow = ${'<div class="row">' + value + '</div>'}
content.@process.wrapRow.@if = ${someProperty == true}