{% set video = article.video %}
{% set videoType = article.video.type | default ('') %}
{% set button = button | default(false) %}
{% set title = article.title %}
{% set text = article.shortDescription %}
{% set link = linkGenerator().generate(article, {'relative': relative|default(false), 'document': document}) %}
<section class="article-teaser {{ video ? 'js-lightbox' : '' }} {{ button ? 'stretch-link isCursor' : '' }} {{ areaWide ? 'article-teaser--wide' : '' }}"
{% if video %}
data-lightbox-video="true"
{% endif %}>
{% do jsConfig().add('lazyImg', true) %}
{% do jsConfig().add('goToLink', true) %}
{% if not video %}
<div class="article-teaser__img-wrapper">
<div class="embed-responsive {{ areaWide ? 'article-teaser__embed--wide' : 'article-teaser__embed' }}">
{% if article.teaserImage %}
{{ article.teaserImage.getThumbnail(areaWide ? 'article-teaser--wide' : 'article-teaser').getHtml({
imgAttributes: {
'class' : 'embed-responsive-item js-lazy-img article-teaser__img'
},
'lowQualityPlaceholder' : true})
| raw
}}
{% endif %}
</div>
{% if article.topArticle %}
{{ include('Magazine/Includes/triangle-badge.html.twig', {
'text': article.getAdvertismentNote() ?: ("magazine.top-article.badge" | trans),
'position': 'left',
'styleModifier': ''
}) }}
{% endif %}
</div>
{% else %}
{% do jsConfig().add('lightbox', true) %}
{% do jsConfig().add('video', true) %}
<div data-html="#videoLightbox-{{ article.id }}" data-sub-html="<div class='lightbox-content__title'>{{ article.videoText }}</div><div class='lightbox-content__text'>{{ article.videoDescription | nl2br }}</div>"
class="lightbox-video js-lightbox__item {{ videoType == 'asset' ? 'lg-html5': ''}}">
<div class="article-teaser__img-wrapper">
<div class="embed-responsive {{ areaWide ? 'article-teaser__embed--wide' : 'article-teaser__embed' }}">
{% if article.teaserImage %}
{{ article.teaserImage.getThumbnail(areaWide ? 'article-teaser--wide' : 'article-teaser').getHtml({
imgAttributes: {
'class' : 'embed-responsive-item js-lazy-img article-teaser__img'
},
'lowQualityPlaceholder' : true})
| raw
}}
{% endif %}
</div>
{% if article.topArticle %}
{{ include('Magazine/Includes/triangle-badge.html.twig', {
'text': article.topArticle.getAdvertismentNote() ?: ("magazine.top-article.badge" | trans),
'position': 'left',
'styleModifier': ''
}) }}
{% endif %}
<button type="button"
class="video__play-btn article-teaser__play-btn"
aria-label="{{ 'sr.Open Video'|trans }}"
title="{{ 'sr.Open Video'|trans }}">
<span class="icon icon-play video__play-btn__icon" aria-hidden="true"></span>
</button>
</div>
</div>
<div id="videoLightbox-{{ article.id }}" style="display: none;">
{% if videoType == 'asset' %}
{% set options = {
'imagethumbnail': 'lightbox-video-poster',
'width': '100%',
'height': '100%',
'attributes': {
'controls': 'controls',
'preload': 'none',
'class': 'lg-video-object lg-html5 video-js vjs-default-skin'
}
} %}
{% set displayVideo = elements_videoHelper().getVideoTag(video, options) %}
{{ displayVideo | raw }}
{% else %}
{% if videoType == 'youtube' %}
{% set src = "https://www.youtube-nocookie.com/embed/" ~ elements_videoHelper().getRealYoutubeId(video.data) %}
{% endif %}
{% if videoType == 'vimeo' %}
{% set src = "https://player.vimeo.com/video/" ~ elements_videoHelper().getRealVimeoId(video.data) %}
{% endif %}
{% if videoType == 'dailymotion' %}
{% set src = "https://www.dailymotion.com/embed/video/" ~ video.data %}
{% endif %}
<iframe class="js-lazy-iframe lightbox-video__iframe"
data-src="{{ src|default('') }}"
frameborder="0"
allow="autoplay; encrypted-media"
allowfullscreen></iframe>
{% endif %}
</div>
{% endif %}
<div class="article-teaser__body">
<h3 class="article-teaser__title">
{# if article-teaser has video - no button and no detail-page #}
{% if not video %}
<a href="{{ link }}" class="stretch-link__link">
{{ title }}
</a>
{% else %}
{{ title }}
{% endif %}
</h3>
<div class="article-teaser__content">
{{ text }}
</div>
{% if not video %}
<a href="{{ link }}" class="article-teaser__btn btn btn-outline-primary">
{{ 'magazine.Artikel lesen' | trans }}
</a>
{% endif %}
</div>
</section>