menu--main-backup.html.twig 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. {#
  2. /**
  3. * @file
  4. * Theme override to display a menu.
  5. *
  6. * Available variables:
  7. * - menu_name: The machine name of the menu.
  8. * - items: A nested list of menu items. Each menu item contains:
  9. * - attributes: HTML attributes for the menu item.
  10. * - below: The menu item child items.
  11. * - title: The menu link title.
  12. * - url: The menu link url, instance of \Drupal\Core\Url
  13. * - localized_options: Menu link localized options.
  14. * - is_expanded: TRUE if the link has visible children within the current
  15. * menu tree.
  16. * - is_collapsed: TRUE if the link has children within the current menu tree
  17. * that are not currently visible.
  18. * - in_active_trail: TRUE if the link is in the active trail.
  19. */
  20. #}
  21. {% import _self as menus %}
  22. {#
  23. We call a macro which calls itself to render the full tree.
  24. @see http://twig.sensiolabs.org/doc/tags/macro.html
  25. #}
  26. <div class="navbar navbar-default">
  27. <ul class="nav navbar-nav">
  28. <li class="nav navbar-link">
  29. <a href="#" data-target="#" data-toggle="dropdown">
  30. MSSMat en bref
  31. <span class="caret" />
  32. </a>
  33. <ul class="dropdown-menu dropdown">
  34. <li><a href="#">Organisation</a></li>
  35. <li><a href="#">Production scientifique</a></li>
  36. <li><a href="#">Implication dans l'Enseignement</a></li>
  37. <li><a href="#">Collaborations et Partenariats</a></li>
  38. </ul>
  39. </li>
  40. <li class="nav navbar-link">
  41. <a href="#" data-target="#" data-toggle="dropdown">
  42. Recherche
  43. <span class="caret" />
  44. </a>
  45. <ul class="dropdown-menu dropdown">
  46. <li><a href="#">Equipe Sciences et Ingénierie des Matériaux</a></li>
  47. <li><a href="#">Equipe Sciences et Ingénierie Numérique</a></li>
  48. <li><a href="#">Axe CM3</a></li>
  49. <li><a href="#">Axe DynOdAs</a></li>
  50. <li><a href="#">Axe MPI</a></li>
  51. </ul>
  52. </li>
  53. <li class="nav navbar-link">
  54. <a href="#" data-target="#" data-toggle="dropdown">
  55. Moyens
  56. <span class="caret" />
  57. </a>
  58. <ul class="dropdown-menu dropdown">
  59. <li><a href="#">Logiciels</a></li>
  60. <li><a href="#">Essais Mécaniques</a></li>
  61. <li><a href="#">Microscopie</a></li>
  62. <li><a href="#">Machines de Nanomatériaux</a></li>
  63. </ul>
  64. </li>
  65. </ul>
  66. </div>
  67. {{ menus.menu_links(items, attributes, 0) }}
  68. {% macro menu_links(items, attributes, menu_level) %}
  69. {% import _self as menus %}
  70. {% if items %}
  71. {% if menu_level == 0 %}
  72. <ul{{ attributes }}>
  73. {% else %}
  74. <ul>
  75. {% endif %}
  76. {% for item in items %}
  77. <li{{ item.attributes }}>
  78. {{ link(item.title, item.url) }}
  79. {% if item.below %}
  80. {{ menus.menu_links(item.below, attributes, menu_level + 1) }}
  81. {% endif %}
  82. </li>
  83. {% endfor %}
  84. </ul>
  85. {% endif %}
  86. {% endmacro %}