src/Menu/MainMenu.php line 85

  1. <?php
  2. /**
  3.  * This file is part of the NautilePlus package.
  4.  *
  5.  * (c) Nicolas SOBOLEV <nicolas.sobolev@nautile.sarl>
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10. namespace App\Menu;
  11. use Symfony\Bundle\SecurityBundle\Security;
  12. /**
  13.  * Main menu constructor.
  14.  *
  15.  * @author Nicolas SOBOLEV <nicolas.sobolev@nautile.sarl>
  16.  */
  17. class MainMenu
  18. {
  19.     /**
  20.      * Security service.
  21.      *
  22.      * @var Security
  23.      */
  24.     private $security;
  25.     /**
  26.      * Service initialization.
  27.      */
  28.     public function __construct(array $optionsSecurity $security)
  29.     {
  30.         $items = [
  31.             [
  32.                 'label' => 'main_menu.home.label',
  33.                 'icon' => 'main_menu.home.icon',
  34.                 'name' => 'home',
  35.                 // 'uri' => ...
  36.                 'route' => 'app_index',
  37.                 // 'routeParams' =>
  38.                 // 'current' => true,
  39.                 // 'attributes' => [
  40.                     // 'class' => 'nav-item',
  41.                     // ... attributes of the item
  42.                 // ],
  43.             ],
  44.             [
  45.                 'label' => 'main_menu.contact.label',
  46.                 'icon' => 'main_menu.contact.icon',
  47.                 'name' => 'contact',
  48.                 'uri' => 'https://nautile.support',
  49.                 // 'route' => 'contact_support',
  50.                 // 'attributes' => [
  51.                 //     'show-in-modal' => null,                    
  52.                 // ],
  53.             ],
  54.             [
  55.                 'label' => 'main_menu.help.label',
  56.                 'icon' => 'main_menu.help.icon',
  57.                 'name' => 'login',
  58.                 'uri' => 'https://nautile.video',
  59.             ],
  60.         ];
  61.         // if ($security->isGranted('IS_AUTHENTICATED_REMEMBERED')) {
  62.         //     $items[1] = [
  63.         //         'label' => 'main_menu.dashboard.label',
  64.         //         'name' => 'dashboard',
  65.         //         'icon' => 'main_menu.dashboard.icon',
  66.         //         'route' => 'app_dashboard',
  67.         //     ];
  68.         // }
  69.         $menuAttr = [
  70.             // 'fullwidth' => '',
  71.             'class' => 'navbar-nav',
  72.         ];
  73.         if (isset($options['attributes'])) {
  74.             $menuAttr array_merge($menuAttr$options['attributes']);
  75.         }
  76.         $this->attributes $menuAttr;
  77.         $this->items $items;
  78.     }
  79. }