templates/pages/_includes/_breadcrumb.html.twig line 1

Open in your IDE?
  1. {#
  2. Composant fil d'Ariane réutilisable
  3. Paramètres disponibles :
  4. - items : array d'items avec { label, url (optionnel) }
  5. - homeUrl : URL de la page d'accueil (par défaut: sulu_content_root_path())
  6. - cruisesUrl : URL de la page Croisières (optionnel)
  7. - destination : objet destination avec { name, url (optionnel) }
  8. - company : objet compagnie avec { name, url (optionnel) }
  9. - productTitle : titre du produit (optionnel)
  10. #}
  11. {% set homeUrl = homeUrl|default(sulu_content_root_path()) %}
  12. {% set cruisesUrl = cruisesUrl|default(null) %}
  13. {# Si cruisesUrl n'est pas fourni, chercher dans le sitemap #}
  14. {% if cruisesUrl is null %}
  15. {% for mainPage in sulu_sitemap().children %}
  16. {% if mainPage.template is defined and mainPage.template == 'cruises_search_engine_temporary' %}
  17. {% set cruisesUrl = sulu_content_path(mainPage.url, mainPage.webspaceKey) %}
  18. {% endif %}
  19. {% endfor %}
  20. {% endif %}
  21. {# Si cruisesUrl est toujours null, utiliser une URL par défaut #}
  22. {% if cruisesUrl is null %}
  23. {% set cruisesUrl = '/croisieres' %}
  24. {% endif %}
  25. <nav class="breadcrumb" aria-label="{{ 'breadcrumb.aria_label'|trans }}">
  26. <ol
  27. class="breadcrumb-list">
  28. {# Accueil #}
  29. <li class="breadcrumb-item">
  30. <a href="{{ homeUrl }}" class="breadcrumb-link">{{ 'breadcrumb.home'|trans }}</a>
  31. </li>
  32. {# Si des items personnalisés sont fournis, les utiliser #}
  33. {% if items is defined and items is not empty %}
  34. {% for item in items %}
  35. <li class="breadcrumb-item">
  36. {% if item.url is defined and item.url is not empty %}
  37. <a href="{{ item.url }}" class="breadcrumb-link">{{ item.label }}</a>
  38. {% else %}
  39. <span class="breadcrumb-current">{{ item.label }}</span>
  40. {% endif %}
  41. </li>
  42. {% endfor %}
  43. {# Sinon, construire automatiquement depuis les paramètres #}
  44. {% else %}
  45. {# Croisières #}
  46. <li class="breadcrumb-item">
  47. <a href="{{ cruisesUrl }}" class="breadcrumb-link">{{ 'breadcrumb.cruises'|trans }}</a>
  48. </li>
  49. {# Destination #}
  50. {% if destination is defined and destination is not empty %}
  51. <li class="breadcrumb-item">
  52. {% if destination.url is defined and destination.url is not empty %}
  53. <a href="{{ destination.url }}" class="breadcrumb-link">{{ destination.name }}</a>
  54. {% else %}
  55. <span class="breadcrumb-current">{{ destination.name }}</span>
  56. {% endif %}
  57. </li>
  58. {% endif %}
  59. {# Compagnie #}
  60. {% if company is defined and company is not empty %}
  61. <li class="breadcrumb-item">
  62. {% if company.url is defined and company.url is not empty %}
  63. <a href="{{ company.url }}" class="breadcrumb-link">{{ company.name }}</a>
  64. {% else %}
  65. <span class="breadcrumb-current">{{ company.name }}</span>
  66. {% endif %}
  67. </li>
  68. {% endif %}
  69. {# Titre du produit (dernier élément, non cliquable) #}
  70. {% if productTitle is defined and productTitle is not empty %}
  71. <li class="breadcrumb-item">
  72. <span class="breadcrumb-current">{{ productTitle }}</span>
  73. </li>
  74. {% endif %}
  75. {% endif %}
  76. </ol>
  77. </nav>