mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-09-13 21:57:16 +02:00
Added node menu
This commit is contained in:
@@ -40,6 +40,24 @@ class NodeController extends AbstractEntityController
|
||||
return $this->redirectToRouteById('app_law_show',$lawId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/node/{id}/parents.{_format}", defaults={"_format"="html"})
|
||||
*/
|
||||
public function parents(int $id):Response{
|
||||
/**
|
||||
* @todo Implement
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/node/{id}/childs.{_format}", defaults={"_format"="html"})
|
||||
*/
|
||||
public function childs(int $id):Response{
|
||||
/**
|
||||
* @todo Implement
|
||||
*/
|
||||
}
|
||||
|
||||
protected function setEntityName(): void
|
||||
{
|
||||
$this->entityName = Node::class;
|
||||
|
@@ -61,7 +61,7 @@ abstract class AbstractEntityMenuSubscriber implements EventSubscriberInterface
|
||||
]);
|
||||
}
|
||||
|
||||
private function getRequestId(Event $event): int
|
||||
protected function getRequestId(Event $event): int
|
||||
{
|
||||
return $event->getRequest()->getCurrentRequest()->attributes->get('id');
|
||||
}
|
||||
|
@@ -2,6 +2,7 @@
|
||||
namespace App\Subscriber;
|
||||
|
||||
use App\DBAL\Types\MenuEventType;
|
||||
use App\Event\Menu\MenuEvent;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -10,6 +11,39 @@ use App\DBAL\Types\MenuEventType;
|
||||
*/
|
||||
class NodeMenuSubscriber extends AbstractEntityMenuSubscriber
|
||||
{
|
||||
public function onNodeMenuConfigure(MenuEvent $event): void
|
||||
{
|
||||
$menu = $event->getItem();
|
||||
$this->generateShowDropdown($menu, $event,'app_source_show');
|
||||
$menu->addChild($this->translator->trans('law'), [
|
||||
'route' => 'app_node_law',
|
||||
'routeParameters' => [
|
||||
'id' => $this->getRequestId($event),
|
||||
],
|
||||
'attributes' => [
|
||||
'icon' => 'fa fa-gavel',
|
||||
],
|
||||
]);
|
||||
$menu->addChild($this->translator->trans('parents'), [
|
||||
'route' => 'app_node_parents',
|
||||
'routeParameters' => [
|
||||
'id' => $this->getRequestId($event),
|
||||
],
|
||||
'attributes' => [
|
||||
'icon' => 'fa fa-female',
|
||||
],
|
||||
]);
|
||||
$menu->addChild($this->translator->trans('childs'), [
|
||||
'route' => 'app_node_childs',
|
||||
'routeParameters' => [
|
||||
'id' => $this->getRequestId($event),
|
||||
],
|
||||
'attributes' => [
|
||||
'icon' => 'fa fa-child',
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getSubscribedEvents()
|
||||
{
|
||||
return [
|
||||
|
@@ -13,7 +13,7 @@ class SourceMenuSubscriber extends AbstractEntityMenuSubscriber
|
||||
$menu->addChild($this->translator->trans('edit'), [
|
||||
'route' => 'app_source_edit',
|
||||
'routeParameters' => [
|
||||
'id' => $event->getRequest()->getCurrentRequest()->attributes->get('id'),
|
||||
'id' => $this->getRequestId($event),
|
||||
],
|
||||
'attributes' => [
|
||||
'icon' => 'fas fa-edit',
|
||||
@@ -23,7 +23,7 @@ class SourceMenuSubscriber extends AbstractEntityMenuSubscriber
|
||||
$menu->addChild($this->translator->trans('node'), [
|
||||
'route' => 'app_source_node',
|
||||
'routeParameters' => [
|
||||
'id' => $event->getRequest()->getCurrentRequest()->attributes->get('id'),
|
||||
'id' => $this->getRequestId($event),
|
||||
],
|
||||
'attributes' => [
|
||||
'icon' => 'fas fa-globe',
|
||||
|
Reference in New Issue
Block a user