Hi,
I’m trying to render a collection of nodes recursively in their original order. The nested structure of the nodes is:
Test-Cat A
-SubCat A.1
--SubCat A.1.1
--SubCat A.1.2.
-SubCat A.2
--SubCat A.2.1
--SubCat A.2.2.
Test-Cat B
My attempt to get them keeping their order:
prototype(V.S:ItemCollection) < prototype(Neos.Fusion:Collection) {
collection = Neos.Fusion:RawCollection {
@context.node = ${q(documentNode)}
collection = ${q(node).children('[instanceof V.S:Category]')}
itemName = 'node'
itemRenderer = Neos.Fusion:Case {
categoryWithChildren {
condition = ${q(node).children('[instanceof V.S:Category]').is()}
renderer = Neos.Fusion:RawArray { #<-- the RawArray may be the problem
node = ${node}
next = V.S:GetCategoriesRecursive
}
}
childlessCategory {
condition = ${!q(node).children('[instanceof V.S:Category]').is()}
renderer = ${node}
}
}
}
itemRenderer = Neos.Fusion:Case {
array {
condition = ${Type.isArray(category)}
renderer = V.S:CategoryCollection {
collection = ${category}
}
}
node {
condition = true
renderer = Neos.Fusion:Tag {
tagName = 'li'
content = ${category.properties.title}
}
}
}
@process.embedInLayout = Neos.Fusion:Tag {
tagName = 'ul'
content = ${value}
}
}
Basically the prototype works, because it yields the nodes it should be and it preserves the order/structure. My problem is, that I have/create too many arrays, while fetching the nodes. That becomes obvious, if you look at the generated output: There are too many <ul>
tags. I’m pretty sure that the RawArray is the problem, but I don’t know how to avoid it.
<ul>
<ul>
<li>Test-SubCat A</li>
<ul>
<ul>
<li>SubCat A.1</li>
<ul>
<li>SubCat A.1.1</li>
<li>SubCat A.1.2.</li>
</ul>
</ul>
<ul>
<li>SubCat A.2</li>
<ul>
<li>SubCat A.2.1</li>
<li>SubCat A.2.2.</li>
</ul>
</ul>
</ul>
</ul>
<li>Test-SubCat B</li>
</ul>
Any ideas how to avoid the RawArray?