templates/_snippets/companies_slide.html.twig line 1

Open in your IDE?
  1. {# Valeurs de base #}
  2. {% set effectiveSectionSettings = showSectionSettings|default(true) ? sectionSettings|default({}) : {} %}
  3. {% set content = effectiveSectionSettings|merge(companiesSlide) %}
  4. {% set companies = partners_snippet_companies() %}
  5. {% set datas = {} %}
  6. {% if content is defined and content is not none and content is not empty %}
  7. {% set datas = datas|merge({'section': section(content)}) %}
  8. {% set datas = datas|merge({'title': title(content)}) %}
  9. {% set companiesSlideId = datas.section.id|default('companies-slide-' ~ random()) %}
  10. {% set isBlackAndWhite = content.isBlackAndWhite|default(false) %}
  11. <section id="{{ companiesSlideId }}" class="companies-slide-section">
  12. {% if showSectionSettings|default(true) and attribute(content, 'titleTextSection')|default('') is not empty %}
  13. {{ ('<'~attribute(content, 'typeTitleSection')|default('h2')~' class="companies-slide-title">')|raw }}
  14. {% if attribute(content, 'pictogramTitleSection')|default('') is not empty %}
  15. <span class="icon">{{ getLucidIcon(attribute(content, 'pictogramTitleSection')) }}</span>
  16. {% endif %}
  17. {{ attribute(content, 'titleTextSection')|raw }}
  18. {{ ('</'~attribute(content, 'typeTitleSection')|default('h2')~'>')|raw }}
  19. {% elseif datas.title.text is defined and datas.title.text is not empty %}
  20. {{ ('<'~datas.title.level|default('h2')~' class="companies-slide-title">')|raw }}
  21. {{ datas.title.text|raw }}
  22. {{ ('</'~datas.title.level|default('h2')~'>')|raw }}
  23. {% endif %}
  24. {% if companies is defined and companies is not empty %}
  25. <div
  26. class="companies-slide"
  27. data-companies-slide
  28. style="margin-bottom: {{ content.slideLinesMarginBottom|default(22) }}{{ content.slideLinesMarginBottomUnit|default('px') }};"
  29. >
  30. <button
  31. type="button"
  32. class="companies-slide__arrow companies-slide__arrow--prev"
  33. aria-label="{{ 'common.previous'|trans }}"
  34. aria-hidden="true"
  35. tabindex="-1"
  36. >
  37. {{ getLucidIcon('chevron-left') }}
  38. </button>
  39. <div
  40. class="companies-slide__viewport"
  41. tabindex="0"
  42. role="region"
  43. aria-label="{{ 'common.companies'|trans|default('Compagnies') }}"
  44. >
  45. <div class="companies-slide__track">
  46. {% for company in companies %}
  47. {% set media = crea_media_get_media(['logo'], company) %}
  48. {% if media is defined and media is not null %}
  49. {% set logoUrl = media.cdnUrl|default('/img/placeholder-company.svg') %}
  50. <div class="company-logo">
  51. {% if company.id is defined and company.id is not null and company.id is not empty %}
  52. <a href="/croisieres?companies[]={{ company.id }}">
  53. <img src="{{ logoUrl }}" alt="{{ company.name|default('Logo compagnie') }}" loading="lazy">
  54. </a>
  55. {% else %}
  56. <img src="{{ logoUrl }}" alt="{{ company.name|default('Logo compagnie') }}" loading="lazy">
  57. {% endif %}
  58. </div>
  59. {% endif %}
  60. {% endfor %}
  61. </div>
  62. </div>
  63. <button
  64. type="button"
  65. class="companies-slide__arrow companies-slide__arrow--next"
  66. aria-label="{{ 'common.next'|trans }}"
  67. aria-hidden="true"
  68. tabindex="-1"
  69. >
  70. {{ getLucidIcon('chevron-right') }}
  71. </button>
  72. </div>
  73. {% endif %}
  74. </section>
  75. {% endif %}
  76. <style>
  77. {% include '_snippets/components/_section.html.twig' %}
  78. {% include '_snippets/components/_title.html.twig' %}
  79. section#{{ companiesSlideId }} {
  80. --companies-slide-gap: {{ content.slideGap|default(40) }}{{ content.slideGapUnit|default('px') }};
  81. --companies-slide-logo-height: {{ content.slideHeight|default(90) }}{{ content.slideHeightUnit|default('px') }};
  82. --companies-slide-logo-filter: {{ isBlackAndWhite ? 'grayscale(100%)' : 'grayscale(0%)' }};
  83. --companies-slide-logo-filter-hover: {{ isBlackAndWhite ? 'grayscale(0%)' : 'unset' }};
  84. }
  85. </style>