diff --git a/application/src/Subscriber/AbstractEntityMenuSubscriber.php b/application/src/Subscriber/AbstractEntityMenuSubscriber.php index 65bdfec..a780d37 100644 --- a/application/src/Subscriber/AbstractEntityMenuSubscriber.php +++ b/application/src/Subscriber/AbstractEntityMenuSubscriber.php @@ -16,7 +16,7 @@ abstract class AbstractEntityMenuSubscriber implements EventSubscriberInterface /** * @var TranslatorInterface */ - protected $translator; + private $translator; const FORMAT_TYPES = [ 'html', @@ -31,7 +31,7 @@ abstract class AbstractEntityMenuSubscriber implements EventSubscriberInterface protected function generateShowDropdown(ItemInterface $menu, Event $event,string $route): void { - $dropdown = $menu->addChild($this->translator->trans('show'), [ + $dropdown = $menu->addChild($this->trans('show'), [ 'attributes' => [ 'icon' => 'fas fa-eye', 'dropdown' => 'true' @@ -50,7 +50,7 @@ abstract class AbstractEntityMenuSubscriber implements EventSubscriberInterface ] ]); } - $dropdown->addChild($this->translator->trans('standard'), [ + $dropdown->addChild($this->trans('standard'), [ 'route' => $route, 'routeParameters' => [ 'id' => $this->getRequestId($event) @@ -60,6 +60,10 @@ abstract class AbstractEntityMenuSubscriber implements EventSubscriberInterface ] ]); } + + protected function trans(string $id, array $parameter=[]):string{ + return $this->translator->trans($id,$parameter); + } protected function getRequestId(Event $event): int { diff --git a/application/src/Subscriber/NodeMenuSubscriber.php b/application/src/Subscriber/NodeMenuSubscriber.php index d6c2b73..d24c893 100644 --- a/application/src/Subscriber/NodeMenuSubscriber.php +++ b/application/src/Subscriber/NodeMenuSubscriber.php @@ -15,7 +15,7 @@ class NodeMenuSubscriber extends AbstractEntityMenuSubscriber { $menu = $event->getItem(); $this->generateShowDropdown($menu, $event,'app_source_show'); - $menu->addChild($this->translator->trans('law'), [ + $menu->addChild($this->trans('law'), [ 'route' => 'app_node_law', 'routeParameters' => [ 'id' => $this->getRequestId($event), @@ -24,7 +24,7 @@ class NodeMenuSubscriber extends AbstractEntityMenuSubscriber 'icon' => 'fa fa-gavel', ], ]); - $menu->addChild($this->translator->trans('parents'), [ + $menu->addChild($this->trans('parents'), [ 'route' => 'app_node_parents', 'routeParameters' => [ 'id' => $this->getRequestId($event), @@ -33,7 +33,7 @@ class NodeMenuSubscriber extends AbstractEntityMenuSubscriber 'icon' => 'fa fa-female', ], ]); - $menu->addChild($this->translator->trans('childs'), [ + $menu->addChild($this->trans('childs'), [ 'route' => 'app_node_childs', 'routeParameters' => [ 'id' => $this->getRequestId($event), diff --git a/application/src/Subscriber/SourceMenuSubscriber.php b/application/src/Subscriber/SourceMenuSubscriber.php index 1eaaad4..968ee08 100644 --- a/application/src/Subscriber/SourceMenuSubscriber.php +++ b/application/src/Subscriber/SourceMenuSubscriber.php @@ -10,7 +10,7 @@ class SourceMenuSubscriber extends AbstractEntityMenuSubscriber public function onSourceMenuConfigure(MenuEvent $event): void { $menu = $event->getItem(); - $menu->addChild($this->translator->trans('edit'), [ + $menu->addChild($this->trans('edit'), [ 'route' => 'app_source_edit', 'routeParameters' => [ 'id' => $this->getRequestId($event), @@ -20,7 +20,7 @@ class SourceMenuSubscriber extends AbstractEntityMenuSubscriber ], ]); $this->generateShowDropdown($menu, $event,'app_source_show'); - $menu->addChild($this->translator->trans('node'), [ + $menu->addChild($this->trans('node'), [ 'route' => 'app_source_node', 'routeParameters' => [ 'id' => $this->getRequestId($event),