diff --git a/src/lib/EventListener/ConfigureMainMenuListener.php b/src/lib/EventListener/ConfigureMainMenuListener.php new file mode 100644 index 00000000..e10d8a3d --- /dev/null +++ b/src/lib/EventListener/ConfigureMainMenuListener.php @@ -0,0 +1,77 @@ +menuItemFactory = $menuItemFactory; + $this->permissionResolver = $permissionResolver; + } + + /** + * @param \EzSystems\EzPlatformAdminUi\Menu\Event\ConfigureMenuEvent $event + */ + public function onMenuConfigure(ConfigureMenuEvent $event): void + { + $menu = $event->getMenu(); + + if (!$this->permissionResolver->hasAccess('setup', 'system_info')) { + return; + } + + $menu->getChild(MainMenuBuilder::ITEM_ADMIN)->addChild( + $this->menuItemFactory->createItem( + self::ITEM_ADMIN__SYSTEMINFO, + [ + 'route' => 'ezplatform.systeminfo', + 'extras' => [ + 'orderNumber' => 10, + ], + ], + ) + ); + } + + public static function getSubscribedEvents(): array + { + return [ + ConfigureMenuEvent::MAIN_MENU => 'onMenuConfigure', + ]; + } + + /** + * {@inheritdoc} + */ + public static function getTranslationMessages(): array + { + return [ + (new Message(self::ITEM_ADMIN__SYSTEMINFO, 'menu'))->setDesc('System Information'), + ]; + } +}