Feature: #92508 - PSR-14 event for modifying menu items¶
See forge#92508
Description¶
A new PSR-14 event TYPO3\CMS\Frontend\Event\FilterMenuItemsEvent
has been
introduced which serves as a more powerful and flexible alternative
for the now removed hook
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/tslib/class.tslib_menu.php']['filterMenuPages']
.
The new PSR-14 event has a variety of properties and getters, along with
->getFilteredMenuItems()
and ->setFilteredMenuItems()
. Those
methods can be used to change the items of a menu, which has been generated
with HMENU
.
Impact¶
The main advantage of the PSR-14 event is that it 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 in the PSR-14 event.