mirror of
				https://github.com/kevinveenbirkenbach/infinito.git
				synced 2025-10-31 01:09:41 +00:00 
			
		
		
		
	Added shortcut for trans
This commit is contained in:
		| @@ -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 | ||||
|     { | ||||
|   | ||||
| @@ -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), | ||||
|   | ||||
| @@ -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), | ||||
|   | ||||
		Reference in New Issue
	
	Block a user