infinito/application/src/Subscriber/SourceMenuSubscriber.php

40 lines
1.1 KiB
PHP
Raw Normal View History

2018-09-20 14:26:28 +02:00
<?php
namespace App\Subscriber;
2018-10-04 21:33:50 +02:00
use App\Event\Menu\Subbar\SourceMenuEvent;
2018-09-20 14:26:28 +02:00
2018-10-04 21:25:35 +02:00
class SourceMenuSubscriber extends AbstractEntityMenuSubscriber
2018-09-20 14:26:28 +02:00
{
public function onSourceMenuConfigure(SourceMenuEvent $event): void
{
$menu = $event->getItem();
$menu->addChild($this->translator->trans('edit'), [
'route' => 'app_source_edit',
2018-09-20 14:48:37 +02:00
'routeParameters' => [
'id' => $event->getRequest()->getCurrentRequest()->attributes->get('id'),
],
2018-09-20 14:26:28 +02:00
'attributes' => [
'icon' => 'fas fa-edit',
],
]);
2018-10-04 21:25:35 +02:00
$this->generateShowDropdown($menu, $event,'app_source_show');
2018-09-20 16:03:00 +02:00
$menu->addChild($this->translator->trans('node'), [
'route' => 'app_source_node',
'routeParameters' => [
'id' => $event->getRequest()->getCurrentRequest()->attributes->get('id'),
],
'attributes' => [
'icon' => 'fas fa-globe',
],
]);
2018-09-20 14:48:37 +02:00
}
2018-09-20 14:26:28 +02:00
public static function getSubscribedEvents(): array
{
return [
SourceMenuEvent::EVENT => 'onSourceMenuConfigure',
];
}
}