Hi together,
another basic question:
The following is working just fine:
prototype(MYCOMPANY.Site:Content.ElementListe) < prototype(Neos.Neos:ContentComponent) {
contentlist = Neos.Neos:ContentCollection {
tagName = 'main'
nodePath = 'node'
attributes.class = Neos.Fusion:Case {
eins {
condition = ${q(node).children().count() <= 1}
renderer = 'einspaltig'
}
zwei {
condition = ${q(node).children().count() <= 2}
renderer = 'zweispaltig'
}
// [...]
}
}
renderer = afx`
<!-- stuff ... -->
{props.contentlist}
<!-- other stuff ... ->
`
}
For reasons of readability I would like to split this up into
spaltenklasse = Neos.Fusion:Case {
eins {
condition = ${q(node).children().count() <= 1}
renderer = 'einspaltig'
}
zwei {
condition = ${q(node).children().count() <= 2}
renderer = 'zweispaltig'
}
// [...]
}
and
contentlist = Neos.Neos:ContentCollection {
tagName = 'main'
nodePath = 'node'
attributes.class = spaltenklasse
}
The problem is attributes.class = spaltenklasse
- I found no notation that worked. I tried several variations like
attributes.class = spaltenklasse
attributes.class = ${spaltenklasse}
attributes.class = ${props.spaltenklasse}
attributes.class = ${q(node).property('spaltenklasse')}
attributes.class = ${q(node).parent().property('spaltenklasse')}
attributes.class = afx'{spaltenklasse}'
attributes.class = afx'{props.spaltenklasse}'
- and so on and so forth…
None of them worked - they all rendered empty. For control purposes to see if the attributes.class is used at all I added a static string like ${'test ' + props.spaltenklasse}
. The “test” string was always correctly rendered into the class attribute.
So how can I use variables in nested fusion declarations?