Filtering MenuItems By Property

Hey community! :slight_smile:

I’m currently trying to enable adding a document to navigation by setting a flag. For this, I added a boolean property to the document type. Now I try to filter the MenuItems by a specific property. Unfortunately, it seems that it’s only possible to filter by document type. Is there any workaround?

Thanks in advance and a happy new year to all of you! :slight_smile:

On the contrary, this should work ^^

q(Site).find("[instanceof Foo:Bar][myproperty]")

See FlowQuery Operation Reference — Neos CMS dev-master documentation

Thanks for your response :slight_smile:

Yeah, I’m aware of it. However, it is not possible to convert it to MenuItems, right? At least not out of the box …

It depends on the implementation of your menu items. If you use fusion to iterate over the items, you can add the following to your menu item implementation:

@if.showItem = ${q(item.node).property('propertyName')}

Be aware that filtering by property is slow and can hurt your performance very quickly. Usually a special nodetype or a references property on the homepage is the better solution.