templates/component/menu/main.twig line 1

Open in your IDE?
  1. {% if is_granted('ROLE_USER') %}
  2.     {% trans_default_domain 'main_menu' %}
  3.     <nav class="navbar navbar-expand-lg navbar-light bg-light">
  4.         <div class="container-fluid">
  5.             <a class="navbar-brand" href="#">
  6. {#                <img src="{{ asset('logo.png') }}" alt="" width="40" height="40">#}
  7.             </a>
  8.             <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
  9.                 <span class="navbar-toggler-icon"></span>
  10.             </button>
  11.             <div class="collapse navbar-collapse" id="navbarSupportedContent">
  12.                 <ul class="navbar-nav me-auto mb-2 mb-lg-0">
  13.                     {% for menuItem in item.children %}
  14.                         {% if is_granted('ROLE_USER') %}
  15.                             {% if menuItem.name != 'Logout' and menuItem.name != 'Admin' %}
  16.                                 <li class="nav-item">
  17.                                     <a
  18.                                             class="nav-link {% if matcher.isCurrent(menuItem) %}active{% endif %}"
  19.                                             aria-current="page"
  20.                                             href="{{ path(menuItem.extras['routes'][0]['route'], menuItem.extras['routes'][0]['parameters']) }}">
  21.                                         {{ menuItem.name|trans }}
  22.                                     </a>
  23.                                 </li>
  24.                             {% endif %}
  25.                         {% endif %}
  26.                     {% endfor %}
  27.                 </ul>
  28.                 <ul class="navbar-nav float-lg-end">
  29.                     <li class="nav-item">
  30.                         {% set notificationsCount = item.attributes.notificationsCount  %}
  31.                         {% if notificationsCount > 0 %}
  32.                             <div class="nav-link notification-button" id="notification-button" data-badge="{{ notificationsCount }}">
  33.                                 <span class="material-symbols-outlined">
  34.                                 notifications
  35.                                 </span>
  36.                             </div>
  37.                             {% else %}
  38.                             <div class="nav-link" id="notification-button">
  39.                                 <span class="material-symbols-outlined">
  40.                                 notifications
  41.                                 </span>
  42.                             </div>
  43.                         {% endif %}
  44.                     </li>
  45.                     <li class="nav-item">
  46.                         <a href="{{ path('route.app.profile.profile') }}" class="nav-link">
  47.                             <span class="material-symbols-rounded" >person</span>
  48.                         </a>
  49.                     </li>
  50.                     {% for menuItem in item.children %}
  51.                         {% if menuItem.name == 'Admin' %}
  52.                             <li class="nav-item">
  53.                                 <a
  54.                                         class="nav-link {% if matcher.isCurrent(menuItem) %}active{% endif %}"
  55.                                         aria-current="page"
  56.                                         href="{{ path(menuItem.extras['routes'][0]['route'], menuItem.extras['routes'][0]['parameters']) }}">
  57.                                     <span data-bs-toggle="tooltip" data-bs-placement="left" title="{{ menuItem.name|trans }}" class="material-symbols-rounded" >admin_panel_settings</span>
  58.                                 </a>
  59.                             </li>
  60.                         {% endif %}
  61.                         {% if is_granted('ROLE_USER') %}
  62.                             {% if menuItem.name == 'Logout' %}
  63.                                 <li class="nav-item">
  64.                                     <a
  65.                                             class="nav-link {% if matcher.isCurrent(menuItem) %}active{% endif %}"
  66.                                             aria-current="page"
  67.                                             href="{{ path(menuItem.extras['routes'][0]['route'], menuItem.extras['routes'][0]['parameters']) }}">
  68.                                         <span data-bs-toggle="tooltip" data-bs-placement="left" title="{{ menuItem.name|trans }}" class="material-symbols-rounded" >logout</span>
  69.                                     </a>
  70.                                 </li>
  71.                             {% endif %}
  72.                         {% endif %}
  73.                     {% endfor %}
  74.                 </ul>
  75.             </div>
  76.         </div>
  77.     </nav>
  78.     {% include 'component/marginer.twig' with {props: {class: 'mt-5'}} %}
  79. {% endif %}