user500665
user500665

Reputation: 1364

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

Upvotes: 0

Views: 833

Answers (2)

Bernd Wilke πφ
Bernd Wilke πφ

Reputation: 10800

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
}

Upvotes: 2

Aristeidis Karavas
Aristeidis Karavas

Reputation: 1956

Did you try the entryLevel?

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

Upvotes: 0

Related Questions