FilterMenuItemsEvent

New in version 12.0.

This event has a variety of properties and getters, along with TYPO3\CMS\Frontend\Event\FilterMenuItemsEvent::getFilteredMenuItems() and TYPO3\CMS\Frontend\Event\FilterMenuItemsEvent::setFilteredMenuItems(). Those methods can be used to change the items of a menu, which has been generated with a TypoScript HMENU or a MenuProcessor.

This event is fired after TYPO3 has filtered all menu items. The menu can then be adjusted by adding, removing or modifying the menu items. Also changing the order is possible.

Additionally, more information about the currently rendered menu, such as the menu items which were filtered out, is available.

API

class TYPO3\CMS\Frontend\Event\FilterMenuItemsEvent

Listeners to this Event will be able to modify items for a menu generated with HMENU

getAllMenuItems()
Return type

array

getFilteredMenuItems()
Return type

array

setFilteredMenuItems(array $filteredMenuItems)
Parameters
  • $filteredMenuItems (array) -- the filteredMenuItems

getMenuConfiguration()
Return type

array

getItemConfiguration()
Return type

array

getBannedMenuItems()
Return type

array

getExcludedDoktypes()
Return type

array

getSite()
Return type

TYPO3\CMS\Core\Site\Entity\Site

getContext()
Return type

TYPO3\CMS\Core\Context\Context

getCurrentPage()
Return type

array

History

The PSR-14 event TYPO3CMSFrontendEventFilterMenuItemsEvent has been introduced to serve as a more powerful and flexible alternative for the removed hook $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/tslib/class.tslib_menu.php']['filterMenuPages'].