vendor/ibexa/calendar/src/bundle/UI/Menu/Listener/ConfigureMainMenuListener.php line 29

Open in your IDE?
  1. <?php
  2. /**
  3.  * @copyright Copyright (C) Ibexa AS. All rights reserved.
  4.  * @license For full copyright and license information view LICENSE file distributed with this source code.
  5.  */
  6. declare(strict_types=1);
  7. namespace Ibexa\Bundle\Calendar\UI\Menu\Listener;
  8. use Ibexa\AdminUi\Menu\Event\ConfigureMenuEvent;
  9. use Ibexa\AdminUi\Menu\MainMenuBuilder;
  10. use Ibexa\AdminUi\Menu\MenuItemFactory;
  11. use JMS\TranslationBundle\Model\Message;
  12. use JMS\TranslationBundle\Translation\TranslationContainerInterface;
  13. final class ConfigureMainMenuListener implements TranslationContainerInterface
  14. {
  15.     public const ITEM_CONTENT__CALENDAR 'main__content__calendar';
  16.     /** @var \Ibexa\AdminUi\Menu\MenuItemFactory */
  17.     private $menuItemFactory;
  18.     public function __construct(MenuItemFactory $menuItemFactory)
  19.     {
  20.         $this->menuItemFactory $menuItemFactory;
  21.     }
  22.     public function onMenuConfigure(ConfigureMenuEvent $event): void
  23.     {
  24.         $root $event->getMenu();
  25.         $root->getChild(MainMenuBuilder::ITEM_CONTENT)->addChild(
  26.             $this->menuItemFactory->createItem(
  27.                 self::ITEM_CONTENT__CALENDAR,
  28.                 [
  29.                     'route' => 'ibexa.calendar.view',
  30.                     'extras' => [
  31.                         'orderNumber' => 55,
  32.                     ],
  33.                 ]
  34.             )
  35.         );
  36.     }
  37.     public static function getTranslationMessages(): array
  38.     {
  39.         return [
  40.             (new Message(self::ITEM_CONTENT__CALENDAR'ibexa_menu'))->setDesc('Calendar'),
  41.         ];
  42.     }
  43. }
  44. class_alias(ConfigureMainMenuListener::class, 'EzSystems\EzPlatformCalendarBundle\UI\Menu\Listener\ConfigureMainMenuListener');