infinito/application/src/Subscriber/SourceMenuSubscriber.php

41 lines
1.1 KiB
PHP
Raw Normal View History

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();
2018-10-04 22:45:51 +02:00
$menu->addChild($this->trans('edit'), [
2018-09-20 14:26:28 +02:00
'route' => 'app_source_edit',
2018-09-20 14:48:37 +02:00
'routeParameters' => [
2018-10-04 22:39:26 +02:00
'id' => $this->getRequestId($event),
2018-09-20 14:48:37 +02:00
],
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-10-04 22:45:51 +02:00
$menu->addChild($this->trans('node'), [
2018-09-20 16:03:00 +02:00
'route' => 'app_source_node',
'routeParameters' => [
2018-10-04 22:39:26 +02:00
'id' => $this->getRequestId($event),
2018-09-20 16:03:00 +02:00
],
'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
];
}
}