{% from '@openform_front_templates/_includes/_icons.html.twig' import arrowright %}
{% if openform_front_util.Config.showHomeNews %}
{% if featuredNews|length > 0 %}
<div class="home-news">
<div class="container block-container">
<div class="block__h2 block-container__title">{{('T_HOME_NEWS')|trans({}, 'openform_front', app.request.locale)}}</div>
<div class="block-container__blocks">
{% for news in featuredNews %}
{% set img = openform_front_util.getImagePathByType(news.Thumb ?? '','detail') %}
{% set href = toolkit_route_localizer.generate('news_item',{ slug : news.Translation[app.request.locale].slug }, app.request.locale) %}
<a href="{{href}}" class="block-item block-image block-image--position-{{ loop.index is divisible by(2) ? 'right' : 'left' }}">
<div class="block-image__container">
<div class="block-image__text">
{% if news.Translation[app.request.locale].titleHtml %}
<div class="block__h3">
{{ news.Translation[app.request.locale].titleHtml|raw }}
</div>
{% endif %}
<div class="home-news__date">
<time class="block__text">
{{ news.publishDate|explodedDate(app.request.locale).D }}
{{ news.publishDate|explodedDate(app.request.locale).month }}
{{ news.publishDate|explodedDate(app.request.locale).y }}
</time>
</div>
{% if news.Translation[app.request.locale].shortLead %}
<div class="block__text">
{{ news.Translation[app.request.locale].shortLead|raw }}
</div>
{% endif %}
{% if href %}
<div class="block-text__btns">
<div class="block-text__btns__btn">
<span>{{('T_SEE_MORE')|trans({}, 'openform_front', app.request.locale)}}</span>
{{arrowright()}}
</div>
</div>
{% endif %}
</div>
<div class="block-image__image">
{% if img %}
<img class="block-image__image__img" loading="lazy" src="{{img}}" alt="{{ news.Translation[app.request.locale].alt }}">
{% endif %}
</div>
</div>
</a>
{% endfor %}
{% set hrefNews = toolkit_route_localizer.generate('news_list',{}, app.request.locale) %}
{% if hrefNews %}
<a href="{{hrefNews}}" class="btn btn--color-white btn--position-right">
<span>{{('T_SEE_ALL_NEWS')|trans({}, 'openform_front', app.request.locale)}}</span> {{arrowright()}}
</a>
{% endif %}
</div>
</div>
</div>
{% endif %}
{% endif %}