templates/News/view.html.twig line 1

Open in your IDE?
  1. <div class="news-boxes row">
  2.     {% for article in news |slice(0, 6) %}
  3.         {% set newssnode = get_node_translation_for(article) %}
  4.             <article
  5.                     class="news-box col-sm-4{% for tag in article.tags %}{% if tag.id == 3 %} photo{% endif %}{% if tag.id == 2 %} video{% endif %}{% endfor %}">
  6.                 <a href="{{ path('_slug', {'url': newssnode.url}) }}{% if refererString is defined and refererString is not empty %}?path={{ refererString }}{% endif %}">
  7.                     <div class="news-box__img">
  8.                         {% if article.listImage and article.listImage is not empty %}
  9.                             {% set img = article.listImage | first %}
  10.                         {% elseif article.headerImage and article.headerImage is not empty %}
  11.                             {% set img = article.headerImage | first %}
  12.                         {% else %}
  13.                             {% set img = {
  14.                                 'cropping' : null,
  15.                                 'media' : {
  16.                                     'url' : get_default_article_image(),
  17.                                 },
  18.                                 'mediaAlt' : 'GdyƄskie Centrum Sportu'
  19.                                 }
  20.                              %}
  21.                         {% endif %}
  22.                         {% if img is defined and img is not empty %}
  23.                             {% set fullSrc = croppedImgSrc(img.media.url, img.cropping, { w: 450, h: 300, q: 80 }) %}
  24.                             {% set previewSrc = croppedImgSrc(img.media.url, img.cropping, jml_img_large.preview) %}
  25.                             <img class="lazy"
  26.                                  src="{{ previewSrc }}" data-src="{{ fullSrc }}"
  27.                                  alt="{% if img.mediaAlt %}{{ img.mediaAlt }}{% else %}{{ article.title | striptags }}{% endif %}" />
  28.                         {% else %}
  29.                             <img src="data:image/gif;base64,R0lGODlhAQABAIAAAMLCwgAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw=="
  30.                                  alt="">
  31.                         {% endif %}
  32.                         {% set img = null %}
  33.                         <div class="news-box__read-more">
  34.                             {{ 'news.read-more' | trans }}
  35.                         </div>
  36.                     </div>
  37.                     <div class="news-box__caption">
  38.                         <h3  role="heading" aria-level="3">{{ article.title }}</h3>
  39.                     </div>
  40.                     <div class="news-box__date">
  41.                         <time datetime="{{ article.date | date("d.m.Y") }}">{{ article.date | date("d.m.Y") }}</time>
  42.                     </div>
  43.                 </a>
  44.             </article>
  45.     {% endfor %}
  46. </div>