You are here

opigno-site-header.html.twig in Opigno dashboard 3.x

Default theme implementation to display the site header block.

Available variables:

  • logo: the site logo;
  • menu: the main menu;
  • is_user_page: if the current page is a user page or not;
  • user_name: the user name;
  • user_url: the url to the user profile page;
  • user_picture: the rendered user profile picture;
  • notifications_count: the amount of unread notifications + ILTs + LMs;
  • notifications: rendered notifications dropdown block;
  • dropdown_menu: the user dropdown menu.

File

templates/opigno-site-header.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Default theme implementation to display the site header block.
  5. *
  6. * Available variables:
  7. * - logo: the site logo;
  8. * - menu: the main menu;
  9. * - is_user_page: if the current page is a user page or not;
  10. * - user_name: the user name;
  11. * - user_url: the url to the user profile page;
  12. * - user_picture: the rendered user profile picture;
  13. * - notifications_count: the amount of unread notifications + ILTs + LMs;
  14. * - notifications: rendered notifications dropdown block;
  15. * - dropdown_menu: the user dropdown menu.
  16. */
  17. #}
  18. <header class="page-header" role="banner">
  19. <div class="container">
  20. <div class="row align-items-center">
  21. {% if not is_anonymous %}
  22. <div class="col-lg-9 col-xxl-8 col-left">
  23. {% else %}
  24. <div class="col-lg-12 col-xxl-12 col-left">
  25. {% endif %}
  26. {# Logo. #}
  27. {% if logo is not empty %}
  28. <div class="region region-branding">
  29. <div class="block-system-branding-block">
  30. <a class="home-link" href="{{ path('<front>') }}">
  31. <img class="logo" src="{{ logo }}" alt="{{ 'Home'|t }}">
  32. </a>
  33. </div>
  34. </div>
  35. {% endif %}
  36. <div class="region-main-menu">
  37. <nav>{{ menu }}</nav>
  38. </div>
  39. {# Mobile menu. #}
  40. <div class="mobile-menu-btn">
  41. <span></span>
  42. <span></span>
  43. <span></span>
  44. </div>
  45. {# Mobile header. #}
  46. <div class="mobile-header-wrapper">
  47. <div class="mobile-header">
  48. <nav>{{ menu }}</nav>
  49. {# Notifications block. #}
  50. <div class="block-notifications">
  51. <div class="block-notifications__item block-notifications__item--notifications">
  52. <div class="dropdown">
  53. <a href="{{ path('view.opigno_notifications.page_all') }}">
  54. <i class="fi fi-rr-bell">
  55. {% set classes = notifications_count != 0 ? 'marker' : 'marker hidden' %}
  56. <span class="{{ classes }}"></span>
  57. </i>
  58. </a>
  59. </div>
  60. </div>
  61. {% block user_menu %}
  62. {# Messages link. #}
  63. <div class="block-notifications__item block-notifications__item--messages">
  64. <div class="dropdown">
  65. <a href="{{ path('private_message.private_message_page') }}">
  66. <i class="fi fi-rr-envelope">
  67. {% set classes = messages_count != 0 ? 'marker' : 'marker hidden' %}
  68. <span class="{{ classes }}"></span>
  69. </i>
  70. </a>
  71. </div>
  72. </div>
  73. {# User dropdown menu. #}
  74. <div class="block-notifications__item block-notifications__item--user-menu">
  75. <div class="dropdown">
  76. <a class="dropdown-toggle" href="#" data-toggle="dropdown" aria-expanded="false">
  77. <i class="fi fi-rr-angle-small-down"></i>
  78. </a>
  79. <div class="dropdown-menu dropdown-menu-right">
  80. <div class="user-menu-block">
  81. <div class="user-name">
  82. {{ dropdown_menu.name }}
  83. <span>{{ dropdown_menu.role }}</span>
  84. </div>
  85. {# Links section. #}
  86. {% block dropdown_menu %}
  87. <ul class="user-menu-list">
  88. {% for key, link in dropdown_menu.links %}
  89. <li class="user-menu-item {{ key }}">
  90. <a href="{{ link.path }}" class="user-menu-item-text" target="{{ link.external ? '_blank' : '_self' }}">
  91. <i class="fi {{ link.icon_class }}"></i>
  92. {{ link.title }}
  93. </a>
  94. </li>
  95. {# Add "About" link for admin. #}
  96. {% if loop.first and dropdown_menu.is_admin %}
  97. <li class="user-menu-item">
  98. <a href="#" class="user-menu-item-text" data-toggle="modal" data-target="#aboutModal">
  99. <i class="fi fi-rr-info"></i>
  100. {{ 'About'|t }}
  101. </a>
  102. </li>
  103. {% endif %}
  104. {% endfor %}
  105. </ul>
  106. {% endblock %}
  107. </div>
  108. </div>
  109. </div>
  110. </div>
  111. {% endblock %}
  112. </div>
  113. {% block profile %}
  114. <div class="block-profile">
  115. <a class="block-profile__link {{ is_user_page ? 'active' }}" href="{{ user_url }}">
  116. <span class="profile-name">{{ user_name }}</span>
  117. <span class="profile-pic">{{ user_picture }}</span>
  118. </a>
  119. </div>
  120. {% endblock %}
  121. {{ block('dropdown_menu') }}
  122. </div>
  123. </div>
  124. </div>
  125. {% if not is_anonymous %}
  126. <div class="col-lg-3 col-xxl-4 col-right">
  127. {{ block('profile') }}
  128. <div class="block-notifications">
  129. <div class="block-notifications__item block-notifications__item--notifications">
  130. <div class="dropdown">
  131. <a class="dropdown-toggle" href="#" data-toggle="dropdown" aria-expanded="false">
  132. <i class="fi fi-rr-bell">
  133. {% set classes = notifications_count != 0 ? 'marker' : 'marker hidden' %}
  134. <span class="{{ classes }}"></span>
  135. </i>
  136. </a>
  137. <div class="dropdown-menu dropdown-menu-right {{ notifications_count == 0 ? 'hidden' }}">
  138. {{ notifications }}
  139. </div>
  140. </div>
  141. </div>
  142. {{ block('user_menu') }}
  143. </div>
  144. </div>
  145. {% endif %}
  146. </div>
  147. </div>
  148. </header>