templates/homepage-articles/presentation-category.html.twig line 1

Open in your IDE?
  1. {% set introClass = "" %}
  2. {% set iconBlock = "" %}
  3. {% if block.category_select == "actualites" %}
  4.     {% set icon = "/resources/img/homepage-icons/actualites-homepage.svg" %}
  5.     {% set links = sulu_navigation_root_tree('main', 3, true)[0].children %}
  6.     {% set CTA_link = sulu_navigation_root_tree('main', 3)[0].url %}
  7.     {% set CTA_title = "Actualités PQN-A" %}
  8.     {% set introClass = "news-section" %}
  9. {% elseif block.category_select == "ressources" %}
  10.     {% set icon = "/resources/img/homepage-icons/ressources-homepage.svg" %}
  11.     {% set links = sulu_navigation_root_tree('main', 3, true)[1].children %}
  12.     {% set CTA_link = sulu_navigation_root_tree('main', 3)[1].url %}
  13.     {% set CTA_title = "Ressources PQN-A" %}
  14.     {% set introClass = "resources-section" %}
  15. {% elseif block.category_select == "acteur-territoire" %}
  16.     {% set icon = "/resources/img/homepage-icons/acteur-territoire-homepage.svg" %}
  17.     {% set links = sulu_navigation_root_tree('main', 3, true)[2].children %}
  18.     {% set CTA_link = sulu_navigation_root_tree('main', 3)[2].url %}
  19.     {% set CTA_title = "Acteurs & Territoires PQN-A" %}
  20.     {% set introClass = "territory-section" %}
  21. {% else %}
  22.     {% set icon = "/resources/img/homepage-icons/qui-sommes-nous-homepage.svg" %}
  23.     {% set links = sulu_navigation_root_tree('main', 3, true)[3].children %}
  24.     {% set CTA_link = sulu_navigation_root_tree('main', 3)[3].url %}
  25.     {% set CTA_title = "Qui sommes-nous ?" %}
  26.     {% set introClass = "whoarewe-section" %}
  27. {% endif %}
  28. {% if block.bg_color == "#00747E" %}
  29.     {% set link_background = "#329B90" %}
  30. {% elseif block.bg_color == "#354161" %}
  31.     {% set link_background = "#495471" %}
  32. {% elseif block.bg_color == "#329B90" %}
  33.     {% set link_background = "#00747E" %}
  34. {% elseif block.bg_color == "#605757" %}
  35.     {% set link_background = "#706868" %}
  36. {% endif %}
  37. <section class="preview-thematique simple ptb-80px {{ introClass }}">
  38.     <div class="preview-thematique-header br8 p-{% if block.title_position is defined and block.title_position is not empty %}{{ block.title_position }}{% endif %}">
  39.     <div class="magic-margin"></div>
  40.         <div class="preview-thematique-title shadow-standard w100 cwhite br8 dflex fdc jcc" {% if block.bg_color %} style="background: {{ block.bg_color }}" {% endif %}>
  41.             <div>
  42.                 {% if icon is defined and icon is not empty %}
  43.                     <img src="{{ icon }}" alt="Icone thematique" loading="lazy" width="80" height="80">
  44.                 {% endif %}
  45.                 {% if block.title %}
  46.                     <h2>{{ block.title }}</h2>
  47.                 {% endif %}
  48.                 {% if block.chapo is defined and block.chapo is not empty %}
  49.                     <p class="lh24">{{ block.chapo }}</p>
  50.                 {% endif %}
  51.                 <ul class="dflex submenu presentation-submenu fwwrap mt-1em {{ block.category_select }}">
  52.                     {% for link in links %}
  53.                         <li>
  54.                             {% set title_class = link.title|lower|slice(0, 12)|replace({"/": "", "-":"", " ": "", "’":"", "'":"","à":"a", "é":"e", "&": ""}) %}
  55.                             <a href="{{ sulu_content_path(link.url) }}" title="{{ link.title }}" class="fw400 nodeco menu-link {{ title_class }}-class prelative cwhite menu-container-icon flex aic" {% if link_background is defined and link_background is not empty %} style="background: {{ link_background }}{% endif %}">
  56.                                 {% for child in link.excerpt.icon %}
  57.                                     {% set iconBlock = false %}
  58.                                     {% if child.url is defined and child.url is not empty %}
  59.                                         {% set iconBlock = child.formats['300x']%}
  60.                                         <span class="category-icon-display">
  61.                                             <img src="{{ iconBlock }}" alt="" width="{{child.fileVersion.properties.width}}" height="{{child.fileVersion.properties.height}}" loading="lazy">
  62.                                         </span>
  63.                                     {% endif %}
  64.                                 {% endfor %}
  65.                                 <div>{{ link.title }}</div>
  66.                             </a>
  67.                         </li>
  68.                     {% endfor %}
  69.                 </ul>
  70.                 {% if CTA_link is defined and CTA_link is not empty %}
  71.                     <a href="{{ CTA_link }}" class="CTA diblock nodeco lh28 ma">{{ CTA_title }}</a>
  72.                 {% endif %}
  73.             </div>
  74.         </div>
  75.         <div class="preview-thematique-image shadow-standard w100">
  76.             {% if block.presentation_image is defined and block.presentation_image is not empty %}
  77.                 <img src="{{ block.presentation_image.formats['600x.webp'] }}" srcset="{{ block.presentation_image.formats['300x.webp'] }} 300w, {{ block.presentation_image.formats['600x.webp'] }} 600w, {{ block.presentation_image.formats['1000x.webp'] }} 1000w" sizes="(max-width: 300px) 300w, (max-width: 600px) 600w, 1000w" alt="{{ block.presentation_image | copyright_or_description_or_title }}" class="br8" width="{{ block.presentation_image.fileVersion.properties.width }}" height="{{ block.presentation_image.fileVersion.properties.height }}" loading="lazy">
  78.             {% endif %}
  79.         </div>
  80.     </div>
  81. </section>