<?php
namespace App\EventSubscriber;
use KevinPapst\AdminLTEBundle\Event\KnpMenuEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
class KNPMenuEventSubscriber implements EventSubscriberInterface
{
/**
* @var TranslatorInterface
*/
private $translator;
/**
* KNPMenuSubscriber constructor.
*
* @param TranslatorInterface $translator
*/
public function __construct(TranslatorInterface $translator)
{
$this->translator = $translator;
}
public function onKnpMenuEventClass(KnpMenuEvent $event)
{
$menu = $event->getMenu();
/*
$menu->addChild('dashboard', [
'route' => 'app_home',
'label' => $this->translator->trans('navigation.dashboard', [], 'backend'),
''
])->setLabelAttribute('icon', 'fas fa-home');
*/
$menu->addChild('order_requests', [
'route' => 'app_order_request_index',
'label' => $this->translator->trans('navigation.orders_new', [], 'backend'),
''
])->setLabelAttribute('icon', 'fas fa-shopping-basket');
/*
$menu->addChild('orders_in_progress', [
'route' => 'app_coming_soon',
'label' => $this->translator->trans('navigation.orders_in_progress', [], 'backend'),
'',
])->setLabelAttribute('icon', 'fas fa-cogs');
$menu->addChild('orders_complete',
[
'route' => 'app_coming_soon',
'label' => $this->translator->trans('navigation.orders_complete', [], 'backend'),
'',
])->setLabelAttribute('icon', 'fas fa-check-square');
*/
$menu->addChild('companies', [
'route' => 'app_company_index',
'label' => $this->translator->trans('navigation.companies', [], 'backend'),
''
])->setLabelAttribute('icon', 'fas fa-address-card');
$menu->addChild('users',
[
'route' => 'app_user_index',
'label' => $this->translator->trans('navigation.users', [], 'backend'),
'',
])->setLabelAttribute('icon', 'fas fa-user-circle');
/*
$menu->addChild('products',
[
'route' => 'app_coming_soon',
'label' => $this->translator->trans('navigation.products', [], 'backend'),
'',
])->setLabelAttribute('icon', 'fas fa-cubes');
*/
$menu->addChild('custom_fields', [
'route' => 'app_custom_field_index',
'label' => $this->translator->trans('navigation.custom_fields', [], 'backend'),
''
])->setLabelAttribute('icon', 'fas fa-cubes');
$menu->addChild('logout', [
'route' => 'app_logout',
'label' => $this->translator->trans('navigation.logout', [], 'backend'),
''
])->setLabelAttribute('icon', 'fas fa-sign-out-alt');
}
public static function getSubscribedEvents()
{
return [
KnpMenuEvent::class => 'onKnpMenuEventClass',
];
}
}