widgets.html.twig 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. {% macro nav_ul_li_a(nav, items) %}
  2. <nav class="navigation {{ nav['classes'] | default }}" title="{{ nav['title'] | trans }}">
  3. <ul class="navigation-ul {{ ul['classes'] | default }}">
  4. {% for item in items %}
  5. <li class="navigation-ul-li">
  6. <a href="{{ path(item['route']) }}" class='{{ item['classes'] | default }}'>{{ item['name'] | trans }}</a>
  7. </li>
  8. {% endfor %}
  9. </ul>
  10. </nav>
  11. {% endmacro nav_ul_li_a %}
  12. {% macro nav_a(nav, items) %}
  13. <nav class="navigation {{ nav['classes'] | default }}" title="{{ nav['title'] | trans }}" {% if nav['tabindex'] is defined %}tabindex={{ nav['tabindex'] }}{% endif %}>
  14. {% for item in items %}
  15. <a class='{{ item['classes'] | default }}' href='{{ path(item['route']) }}'>{{ item['name'] | trans }}</a>
  16. {% endfor %}
  17. </nav>
  18. {% endmacro nav_a %}
  19. {% macro section(title, blocks, classes) %}
  20. <section class="{{ classes['section'] | default }}" title="{{ title | trans }}">
  21. {% for widget in blocks['prepend'] %}
  22. {{ widget | raw }}
  23. {% endfor %}
  24. {% for widget in blocks['main'] %}
  25. {{ widget | raw }}
  26. {% endfor %}
  27. {% for widget in blocks['append'] %}
  28. {{ widget | raw }}
  29. {% endfor %}
  30. </section>
  31. {% endmacro section %}
  32. {% macro details(blocks, classes, is_open = true) %}
  33. <details class="section-details {{ classes['details'] | default }}" {% if is_open %}open="open"{% endif %} title="{% trans %}Expand if you want to access more options{% endtrans %}">
  34. <summary class="details-summary {{ classes['summary'] | default }}">
  35. {% for widget in blocks['summary'] %}
  36. {{ widget | raw }}
  37. {% endfor %}
  38. </summary>
  39. {% for widget in blocks['main'] %}
  40. {{ widget | raw }}
  41. {% endfor %}
  42. </details>
  43. {% endmacro details %}