templates/Magazine/Includes/topArticleTeaser.html.twig line 1

Open in your IDE?
  1. <section class="horizontal-img-text-teaser stretch-link isCursor {{ styleModifier | default(null) }}">
  2.     <div class="row row--gutter-width-0">
  3.         {% if not isTextRight %}
  4.             {{ _self.teaserBody(article, isTextRight) }}
  5.         {% endif %}
  6.         {{ _self.teaserImg(article, isTextRight) }}
  7.         {% if isTextRight %}
  8.             {{ _self.teaserBody(article, isTextRight) }}
  9.         {% endif %}
  10.     </div>
  11. </section>
  12. {% macro teaserBody(article, isTextRight) %}
  13.     <div class="col-md-6 position-static {{ isTextRight ? '' : 'order-2 order-md-1' }}">
  14.         <div class="horizontal-img-text-teaser__body">
  15.             <div class="row justify-content-center align-items-center">
  16.                 <div class="col horizontal-img-text-teaser__top-headline">
  17.                     {% if article.getCategories() and article.getCategories()[0] %}
  18.                         {% set articleTheme = getThemeByCategoryId(article.getCategories()[0].id) %}
  19.                         {% if articleTheme %}
  20.                             {{ articleTheme.name }}
  21.                         {% endif %}
  22.                     {% endif %}
  23.                 </div>
  24.                 {% if article.articleDate %}
  25.                     <div class="col-auto text-right">
  26.                         <time class="horizontal-img-text-teaser__date" datetime="{{  article.articleDate | date('Y-m-d') }}">
  27.                             {{  article.articleDate | date('d.m.Y') }}
  28.                         </time>
  29.                     </div>
  30.                 {% endif %}
  31.             </div>
  32.             {% if article.readingTime or article.categories is not empty %}
  33.                 <ul class="horizontal-img-text-teaser__additional-infos list-inline">
  34.                     {% if article.readingTime %}
  35.                         <li class="horizontal-img-text-teaser__additional-infos__item list-inline-item">
  36.                             <span class="icon icon-clock" aria-label="{{ 'sr.Lesezeit'|trans }}" title="{{ 'sr.Lesezeit'|trans }}"></span>
  37.                             {{ article.readingTime }} {{ 'magazine.Minuten Lesezeit' | trans }}
  38.                         </li>
  39.                     {% endif %}
  40.                     {% if article.categories is not empty %}
  41.                         <li class="horizontal-img-text-teaser__additional-infos__item list-inline-item">
  42.                             <span class="icon icon-tag" aria-label="{{ 'sr.Kategorie'|trans }}"  title="{{ 'sr.Kategorie'|trans }}"></span>
  43.                             {% for category in article.categories %}
  44.                                 {{ category.name }}{% if not loop.last %}, {% endif %}
  45.                             {% endfor %}
  46.                         </li>
  47.                     {% endif %}
  48.                 </ul>
  49.             {% endif %}
  50.             <h3 class="horizontal-img-text-teaser__title">
  51.                 <a href="{{ linkGenerator().generate(article) }}" class="stretch-link__link">
  52.                     {{ article.title }}
  53.                 </a>
  54.             </h3>
  55.             {% if article.shortDescription %}
  56.                 <div class="wysiwyg horizontal-img-text-teaser__content">
  57.                     {{ article.shortDescription | raw }}
  58.                 </div>
  59.             {% endif %}
  60.             <a href="{{ linkGenerator().generate(article) }}" class="btn btn-outline-primary horizontal-img-text-teaser__btn">
  61.                 {{ 'magazine.Artikel lesen'|trans }}
  62.             </a>
  63.         </div>
  64.     </div>
  65. {% endmacro %}
  66. {% macro teaserImg(article, isTextRight) %}
  67.     <div class="col-md-6 {{ isTextRight ? '' : 'order-1 order-md-2' }}">
  68.         {% do jsConfig().add('lazyImg', true) %}
  69.         <div class="horizontal-img-text-teaser__img-wrapper">
  70.             {% if article.topArticle %}
  71.                 {{ include('Magazine/Includes/triangle-badge.html.twig', {
  72.                     'text': article.getAdvertismentNote() ?: ("magazine.top-article.badge" | trans),
  73.                     'position': isTextRight ? 'left' : 'right',
  74.                 }) }}
  75.             {% endif %}
  76.             <div class="embed-responsive embed-responsive-3by2">
  77.                 {% if article.teaserImage %}
  78.                     {{ article.teaserImage.thumbnail('horizontal-img-text-teaser').html({
  79.                         imgAttributes: {
  80.                             class: 'embed-responsive-item js-lazy-img horizontal-img-text-teaser__img'
  81.                         },
  82.                         lowQualityPlaceholder: true,
  83.                     })|raw }}
  84.                 {% endif %}
  85.             </div>
  86.         </div>
  87.     </div>
  88. {% endmacro %}