src/Package/Openform/Front/Templates/Index/components/_news.html.twig line 1

Open in your IDE?
  1. {% from '@openform_front_templates/_includes/_icons.html.twig' import arrowright %}
  2. {% if openform_front_util.Config.showHomeNews %}
  3. {% if featuredNews|length > 0 %}
  4.     <div class="home-news">
  5.         <div class="container block-container">
  6.             <div class="block__h2 block-container__title">{{('T_HOME_NEWS')|trans({}, 'openform_front', app.request.locale)}}</div>
  7.             <div class="block-container__blocks">
  8.                 {% for news in featuredNews %}
  9.                     {% set img = openform_front_util.getImagePathByType(news.Thumb ?? '','detail') %}
  10.                     {% set href = toolkit_route_localizer.generate('news_item',{ slug : news.Translation[app.request.locale].slug }, app.request.locale) %}
  11.                     <a href="{{href}}" class="block-item block-image block-image--position-{{ loop.index is divisible by(2) ? 'right' : 'left' }}">
  12.                         <div class="block-image__container">
  13.                             <div class="block-image__text">
  14.                                 {% if news.Translation[app.request.locale].titleHtml %}
  15.                                     <div class="block__h3">
  16.                                         {{ news.Translation[app.request.locale].titleHtml|raw }}
  17.                                     </div>
  18.                                 {% endif %}
  19.                                 <div class="home-news__date">
  20.                                     <time class="block__text">
  21.                                         {{ news.publishDate|explodedDate(app.request.locale).D }}
  22.                                         {{ news.publishDate|explodedDate(app.request.locale).month }}
  23.                                         {{ news.publishDate|explodedDate(app.request.locale).y }}
  24.                                     </time>
  25.                                 </div>
  26.                                 {% if news.Translation[app.request.locale].shortLead %}
  27.                                     <div class="block__text">
  28.                                         {{ news.Translation[app.request.locale].shortLead|raw }}
  29.                                     </div>
  30.                                 {% endif %}
  31.                                 {% if href %}
  32.                                     <div class="block-text__btns">
  33.                                         <div class="block-text__btns__btn">
  34.                                             <span>{{('T_SEE_MORE')|trans({}, 'openform_front', app.request.locale)}}</span>
  35.                                             {{arrowright()}}
  36.                                         </div>
  37.                                     </div>
  38.                                 {% endif %}
  39.                             </div>
  40.                             <div class="block-image__image">
  41.                                 {% if img %}
  42.                                     <img class="block-image__image__img" loading="lazy" src="{{img}}" alt="{{ news.Translation[app.request.locale].alt }}">
  43.                                 {% endif %}
  44.                             </div>
  45.                         </div>
  46.                     </a>
  47.                 {% endfor %}
  48.                 {% set hrefNews = toolkit_route_localizer.generate('news_list',{}, app.request.locale) %}
  49.                 {% if hrefNews %}
  50.                     <a href="{{hrefNews}}" class="btn btn--color-white btn--position-right">
  51.                         <span>{{('T_SEE_ALL_NEWS')|trans({}, 'openform_front', app.request.locale)}}</span> {{arrowright()}}
  52.                     </a>
  53.                 {% endif %}
  54.             </div>
  55.         </div>
  56.     </div>
  57. {% endif %}
  58. {% endif %}