Hard to give you clear advice without knowing how your node type is configured (NodeTypes.yaml), but you can add a property “numberOfColumn” with a select editor, with value 1,2,3,4,5 and change your TS:
prototype(MO.MyOnepage:ColumnElement) {
@context.numberOfColumn = ${q(node).property('numberOfColumn')}
columnOne = TYPO3.Neos:ContentCollection {
nodePath = 'columnone'
@if.isVisible = ${numberOfColumn >= numberOfColumn}
}
columnTwo = TYPO3.Neos:ContentCollection {
nodePath = 'columntwo'
@if.isVisible = ${numberOfColumn >= numberOfColumn}
}
columnThree = TYPO3.Neos:ContentCollection {
nodePath = 'columnthree'
@if.isVisible = ${numberOfColumn >= numberOfColumn}
}
}
You can even refactor a bit:
prototype(MO.MyOnepage:Column) < prototype(TYPO3.Neos:ContentCollection) {
@if.isVisible = ${numberOfColumn >= numberOfColumn}
}
prototype(MO.MyOnepage:ColumnElement) {
@context.numberOfColumn = ${q(node).property('numberOfColumn')}
columnOne = MO.MyOnepage:Column {
nodePath = 'columnone'
}
columnTwo = MO.MyOnepage:Column {
nodePath = 'columntwo'
}
columnThree = MO.MyOnepage:Column {
nodePath = 'columnthree'
}
}
TLDR, TS outputed from my brain without testing, but should work
From my perspective it’s always better to avoid element configuration, like numberOfColumn and provide multiple node type like we do in the default node types. It’s more easy to the editor. And by example in your case the content inspector (bellow the navigate component), will always show 5 sub content collection, and maybe subcontent, that are not visible / used in the page, that can cause bad UX.
My rule of thumb is always avoid configuration is a custom node type can make the experience more easy for the editor. Like I need 4 columns, I select the “4 columns element”, is way more easy that "I select the magic column element, go to the inspector select the correct group and change the amount of column I need … and I understand that the content inspector do not show me the real content I have on the page, …)
And yes discuss support code highlight, just start the line with 4 spaces caracters
Bests,