taxonomylist.html.twig 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. {% set taxlist = children_only is defined ? taxonomylist.getChildPagesTags() : taxonomylist.get() %}
  2. {% macro pageLinkName(text) %}{{ text|lower|replace({' ':'_'}) }}{% endmacro %}
  3. {% import _self as macro %}
  4. {% if taxlist %}
  5. <div class="btn-toolbar filters">
  6. <div data-toggle="buttons" class="btn-group">
  7. {% set active = uri.param(taxonomy) == tax? 'active' : '' %}
  8. <label class="{{active}} btn btn-default tous" data-filter="">
  9. {% if page.template == "articles" %}
  10. <a class="{{ active }}" href="{{ page.url }}">Tous</a>
  11. {% else %}
  12. <input type="radio" name="options">
  13. Tous
  14. {% endif %}
  15. </label>
  16. {% for tax,value in taxlist[taxonomy] %}
  17. {% set active = uri.param(taxonomy) == tax? 'active' : '' %}
  18. {% set label_class = uri.param(taxonomy) == tax ? 'label-primary' : 'label-secondary' %}
  19. <label class="{{ active }} btn btn-default {{ macro.pageLinkName(tax) }}" data-filter="{{tax}}">
  20. {% if page.template == "articles" %}
  21. <a class="{{ active }}" href="{{ page.url }}/{{ taxonomy }}{{ config.system.param_sep }}{{ tax }}">{{ tax }}</a>
  22. {% else %}
  23. <input type="radio" name="options" >
  24. {{tax}}
  25. {% endif %}
  26. </label>
  27. {% endfor %}
  28. </div>
  29. {% if page.template == 'archive' %}
  30. <div class="btn-group ">
  31. <label class="btn-default archive">
  32. <a href="/{{page.parent.title|lower}}">{{page.parent.title}}</a>
  33. </label>
  34. </div>
  35. {% elseif page.template == 'calendrier' %}
  36. <div class="btn-group ">
  37. <label class="btn-default archive">
  38. <a href="{{page.url}}/archive">Archive</a>
  39. </label>
  40. </div>
  41. {% endif %}
  42. </div>
  43. {% endif %}