templates/blocks/previews/preview-article-logic.html.twig line 1

Open in your IDE?
  1. {% if articleContentLinkedWith is defined and articleContentLinkedWith is not empty %}
  2.     {% set articleContent = articleContentLinkedWith %}
  3. {% else %}
  4.     {% if article.content.content is defined and article.content.content is not empty %}
  5.         {% set articleContent = article.content.content %}
  6.     {% endif %}
  7. {% endif %}
  8. {% if articleContent.header_img is defined and articleContent.header_img is not empty %}
  9.     {% set img = articleContent.header_img %}
  10. {% endif %}
  11. {% if article.excerpt.categories is defined and article.excerpt.categories is not empty %}
  12.     {% set categories = article.excerpt.categories %}
  13. {% endif %}
  14. {% if articleContent.chapo is defined and articleContent.chapo is not empty %}
  15.     {% set chapo = articleContent.chapo %}
  16. {% endif %}
  17. {% if articleContent.contributors is defined and articleContent.contributors is not empty %}
  18.     {% set contributors = articleContent.contributors %}
  19. {% endif %}
  20. {% if article.authorFullName is defined and article.authorFullName is not empty %}
  21.     {% set author = article.authorFullName %}
  22. {% endif %}
  23. {% if articleContent.readtime is defined and articleContent.readtime is not empty %}
  24.     {% set readtime = articleContent.readtime %}
  25. {% endif %}
  26. {% if block.slider_mode is defined and block.slider_mode is not empty  %}
  27.     <li class="splide__slide">
  28.         <div class="preview-container {{ article.type }} br8 dflex fdc">
  29.         {% else %}
  30.             <div class="preview-container {{ article.type }} br8 dflex fdc{% if i > 2 and cancel is defined and not cancel %} not-visible-mobile-article{% endif %}{% if i > 3 and cancel is defined and not cancel %} not-visible-tablette-article{% endif %}">
  31.             {% endif %}
  32.             <div class="preview-header">
  33.                 {% if img is defined and img is not empty %}
  34.                     {% include "blocks/previews/img/image.html.twig" %}
  35.                 {% else %}
  36.                     {% include "blocks/previews/img/default-image.html.twig" %}
  37.                 {% endif %}
  38.                 {% if article.type == "analyses" %}
  39.                     <div class="background-color-blue"></div>
  40.                 {% elseif article.type == "guides_outils" %}
  41.                     <div class="background-color-orange"></div>
  42.                 {% endif %}
  43.                 <p class="fs14 lh20 dflex aic">
  44.                     {% if article.type == "analyses" %}
  45.                         Analyse
  46.                     {% elseif article.type == "guides_outils" %}
  47.                         Guide / Outil
  48.                     {% else %}
  49.                         Article
  50.                     {% endif %}
  51.                 </p>
  52.             </div>
  53.             <div class="preview-content{% if article.type != " articles" %} dflex fdc{% endif %}">
  54.                 {% include "blocks/previews-from-controller/blocks/categories.html.twig" %}
  55.                 <a href="{{ sulu_content_path(article.routePath) }}" class="cblue nodeco{% if article.type != " articles" %} reverse{% endif %}">
  56.                     <div class="fw500 fs20 preview-h3 lh28 mt-8px">{{ article.title }}</div>
  57.                 </a>
  58.                 {% if chapo is defined and chapo is not empty %}
  59.                     {% set number = 0 %}
  60.                     {% if categories is defined and categories is not empty and article.title is defined and article.title is not empty %}
  61.                         {% if (categories|length == 3 and article.title|length < 90) or (categories|length == 2 and article.title|length >= 90) %}
  62.                             {% set number = 137 %}
  63.                         {% elseif (categories|length == 3 and article.title|length > 90) or (categories|length == 2 and article.title|length > 90) %}
  64.                             {% set number = 87 %}
  65.                         {% else %}
  66.                             {% set number = 192 %}
  67.                         {% endif %}
  68.                     {% endif %}
  69.                     <div class="lh24 preview-chapo">
  70.                         {{ chapo|slice(0, number)|striptags|raw }}
  71.                         {% if chapo|length > number %}
  72.                             ...
  73.                             <a href="{{ sulu_content_path(article.routePath) }}" class="cgrey">Lire la suite</a>
  74.                         {% endif %}
  75.                     </div>
  76.                 {% endif %}
  77.             </div>
  78.             <div class="mta">
  79.                 <div class="mt-12px">
  80.                     <div class="dflex jcsb mt-8px">
  81.                         <div class="preview-contributors">
  82.                             {% if article.type == "articles" %}
  83.                                 {% set set_article = true %}
  84.                             {% endif %}
  85.                             {% include "users/contributorDisplay.html.twig" with { article: article} %}
  86.                         </div>
  87.                         {% if readtime is defined and readtime is not empty %}
  88.                             <div class="cgrey fs14 lh20">{{ readtime }}
  89.                                 min de lecture
  90.                             </div>
  91.                         {% endif %}
  92.                     </div>
  93.                 </div>
  94.                 {% if article.authored is defined and article.authored is not empty %}
  95.                     <span class="cgrey fs14 lh20">PubliĆ© le
  96.                         {{ article.authored|format_datetime('short', 'none', locale='fr') }}
  97.                     </span>
  98.                 {% endif %}
  99.             </div>
  100.             {% if block.slider_mode is defined and block.slider_mode is not empty %}
  101.             </div>
  102.         </li>
  103. {% else %}
  104.     </div>
  105. {% endif %}