tokenStorage = $tokenStorage; $this->translator = $translator; } public function onSourceMenuConfigure(SourceMenuEvent $event): void { $menu = $event->getItem(); $menu->addChild($this->translator->trans('edit'), [ 'route' => 'app_source_edit', 'routeParameters' => ['id' => $event->getRequest()->getCurrentRequest()->attributes->get('id')], 'attributes' => [ 'icon' => 'fas fa-edit', ], ]); $menu->addChild($this->translator->trans('show'), [ 'route' => 'app_source_show', 'routeParameters' => ['id' => $event->getRequest()->getCurrentRequest()->attributes->get('id')], 'attributes' => [ 'icon' => 'fas fa-eye', ], ]); } public static function getSubscribedEvents(): array { return [ SourceMenuEvent::EVENT => 'onSourceMenuConfigure', ]; } }