/**
  * Add required menu for admin panel
  */
 public function addAdminMenu()
 {
     $menuItem1 = (new Menu())->setLabel('Categories')->setLink('/admin/bundles/categories')->setOrder(100);
     $menuItem2 = (new Menu())->setLabel('Add Category')->setLink('/admin/bundles/categories/new')->setOrder(110);
     $root = new Menu();
     $root->setLabel('Categories')->setIcon('fa-file-text')->setOrder(100)->addChild($menuItem1)->addChild($menuItem2)->setResources(['categories.manage'])->setAsRoot();
 }
Beispiel #2
0
 /**
  * {@inheritdoc}
  */
 public function __invoke()
 {
     TwigHelper::addCss('file:///Admin/vendor/bootstrap/dist/css/bootstrap.min.css');
     TwigHelper::addCss('file:///Admin/vendor/font-awesome/css/font-awesome.min.css');
     TwigHelper::addCss('file:////code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css');
     TwigHelper::addCss('file:///Admin/css/AdminLTE.min.css', 10);
     TwigHelper::addCss('file:///Admin/css/skins/skin-blue.min.css', 20);
     TwigHelper::addJs('file:////oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js');
     TwigHelper::addJs('file:////oss.maxcdn.com/respond/1.4.2/respond.min.js', 10);
     TwigHelper::addJs('file:///Admin/vendor/jquery/dist/jquery.min.js', 20);
     TwigHelper::addJs('file:///Admin/vendor/bootstrap/dist/js/bootstrap.min.js', 30);
     TwigHelper::addJs('file:///Admin/js/app.min.js', 40);
     $template = 'dashboard';
     $args = func_get_args();
     TwigHelper::addMasterTwig('@Admin/master.twig');
     /** @var \Twig_Environment $twig */
     $twig = $this->getContainer()->get('twig');
     $twig->addGlobal('menu', Menu::generate());
     if (!empty($args) && $args[0] == 'bundles') {
         $this->getRouter()->setPrefix(['admin', 'bundles']);
         array_shift($args);
         $args = implode('/', $args);
         $response = $this->forward($args, $this->getRequest()->getMethod());
         $this->getResponder()->setData('response', $response);
     } else {
         if ($args) {
             $template = implode('/', $args);
         }
     }
     $this->getResponder()->setData('template', $template);
 }
Beispiel #3
0
 /**
  * Add child to menu
  *
  * @param Menu $child
  *
  * @return $this
  */
 public function addChild(Menu $child)
 {
     $this->children[$child->getOrder() . '--' . $child->getLabel()] = $child;
     return $this;
 }
Beispiel #4
0
 /**
  * Add required menu for admin panel
  */
 public function addAdminMenu()
 {
     $menuItem1 = (new Menu())->setLabel('Users')->setLink('/admin/bundles/users')->setOrder(100);
     $menuItem2 = (new Menu())->setLabel('Add User')->setLink('/admin/bundles/users/new')->setOrder(110);
     $menuItem3 = (new Menu())->setLabel('Import User')->setLink('/admin/bundles/users/import')->setOrder(120);
     $menuItem4 = (new Menu())->setLabel('Roles')->setLink('/admin/bundles/users/roles')->setOrder(130);
     $menuItem5 = (new Menu())->setLabel('Add Role')->setLink('/admin/bundles/users/roles/new')->setOrder(140);
     $root = new Menu();
     $root->setLabel('Users')->setIcon('fa-file-text')->setOrder(999)->addChild($menuItem1)->addChild($menuItem2)->addChild($menuItem3)->addChild($menuItem4)->addChild($menuItem5)->setResources(['users.manage'])->setAsRoot();
 }