Search code examples
typo3typoscriptfluidtypo3-9.x

TYPO3 MenuProcessor shows root page when empty?


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
        }
}

Solution

  • 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
    }