Hey guys,
can I restrict a Menu (TYPO3.Neos.NodeTypes:Menu) like in TS1 HMENU maxItems = 3
Thank you for you answers
Hey guys,
can I restrict a Menu (TYPO3.Neos.NodeTypes:Menu) like in TS1 HMENU maxItems = 3
Thank you for you answers
Hi, you can slice the itemCollection, example based on the Demo package:
mainMenu = Menu {
itemCollection = ${q(site).add(q(site).children('[instanceof TYPO3.Neos:Document]')).get()}
itemCollection.@process.keepOnlyTheFirstTwoItems = ${q(value).slice(0,2).get()}
}
keepOnlyTheFirstTwoItems
is just a key. and value in the EEL expression is an array of nodes. We create a new FlowQuery, slice the array from the beginning and keep 2 elements, and return an array of node with the get
method. The menu must look something like this:
Hope that help
Is there any way to do this in a menu with setted Starting Point?
I’ve tried this with:
itemCollection.@process.keepOnlyTheFirstTwoItems = ${q(value).slice(0,2).get()}
but is does not work.
Can you share your complete fusion snippet?
Thank you for your answer.
Here is the snippet, but I use only the Menu Nodetype to select the Startingpoint in the Inspector.
The menu shows all sites below the Startingpoint. It’s okay, but it should show only 4 sites.
prototype(MyProject:NewsMenu) < prototype(TYPO3.Neos.NodeTypes:Menu) {
templatePath = 'resource://MyProject.Website/Private/Templates/TypoScriptObjects/NewsMenu.html'
}
You wrote:
Where did you add this?
This doesn’t work:
prototype(MyProject:NewsMenu) < prototype(TYPO3.Neos.NodeTypes:Menu) {
templatePath = 'resource://MyProject.Website/Private/Templates/TypoScriptObjects/NewsMenu.html'
itemCollection.@process.keepOnlyTheFirstTwoItems = ${q(value).slice(0,2).get()}
}
?
This works, but it shows the first two items from rootmenu. Not from Startpoint
Ok. I have do this with Fluid. In my for-loop I have used “cycle”