TYPO3 MenuProcessor shows root page when empty?

704 views Asked by At

I have a basic menu element using the Pages field and the MenuProcessor.

In the fluid template I only want to output something only if there are pages in the Page field. But if the field is empty the MenuProcessor adds the root page to the array.

How do I prevent the root page being added to what should be an empty array?

typoscript looks like this:

dataProcessing {
        10 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor
        10 {
             special = list
             special.value.field = pages
             levels = 1
             as = menuItems
             expandAll = 1
             includeNotInMenu = 1
             titleField = nav_title // title
        }
}
2

There are 2 answers

2
Bernd Wilke πφ On BEST ANSWER

I suppose it is a very special edge case (which could be handled in the menu processor, you might open a ticket on https://forge.typo3.org ).

As you have identified the reason with empty input parameters you might build a condition on that case.
Either in FLUID or in typoscript.
In typoscript you could add a stdWrap function:

10 { 
   :

   if.isTrue.field = pages
}
1
Aristeidis Karavas On

Did you try the entryLevel?

dataProcessing {
   10 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor
   10 {
       entryLevel = 0
   }
}