2018-09-20 14:26:28 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Subscriber;
|
|
|
|
|
2018-10-04 22:05:31 +02:00
|
|
|
use App\Event\Menu\MenuEvent;
|
|
|
|
use App\DBAL\Types\MenuEventType;
|
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
|
|
|
{
|
2018-10-04 22:05:31 +02:00
|
|
|
public function onSourceMenuConfigure(MenuEvent $event): void
|
2018-09-20 14:26:28 +02:00
|
|
|
{
|
|
|
|
$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 [
|
2018-10-04 22:05:31 +02:00
|
|
|
MenuEventType::SOURCE => 'onSourceMenuConfigure',
|
2018-09-20 14:26:28 +02:00
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|