<?php
namespace App\Http\Admin\Menu;
use App\Infrastructure\Menu\Data\Menu;
use App\Infrastructure\Menu\Event\MenuAdminEvent;
use Knp\Menu\ItemInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class CustomerSubscriber extends Menu implements EventSubscriberInterface
{
/**
* @var ItemInterface
*/
protected $menu;
/**
* Items to add in menu
*
* @var array
*/
private static $items = array(
[
'Clients',
[
'route' => 'admin_customer_index',
'attributes' => [
'permission' => [
'attribute' => 'module_customer_listing',
'object' => ''
]
]
],
[]
]
);
/**
* @param MenuAdminEvent $event
*/
public function onMenuConfigure(MenuAdminEvent $event)
{
$this->menu = $event->getMenu();
foreach (self::$items as $data) {
$this->addItem($data[0], $data[1], $data[2]);
}
}
public static function getSubscribedEvents()
{
return [
MenuAdminEvent::CONFIGURE => ['onMenuConfigure',97],
];
}
}