templates/Pages/NewsOverviewPage/pagetemplate.html.twig line 1

Open in your IDE?
  1. {% set currentUrl = app.request.attributes.get('_nodeTranslation').url %}
  2. {% set baseRoute = '_slug' ~ (app.request.attributes.get('preview') ? '_preview' : '') %}
  3. {% set basePath = path(baseRoute, { 'url': currentUrl, '_locale': app.request.locale }) %}
  4. {% set categoryContext = get_article_categories(app.request, 'App:NewsCategory') %}{% set tagContext = get_article_tags(app.request, 'App:NewsTag') %}
  5. <div class="news-overview news-page">
  6.     {# Page Header #}
  7.     {% include 'Layout/_page-header.html.twig' with { 'page' : page } %}
  8.     {# Breadcrumbs #}
  9.     {% block breadcrumbs %}
  10.         {% include 'Layout/_breadcrumbs.html.twig' with { 'refererString' : app.request.get('path') } %}
  11.     {% endblock %}
  12.     <div class="content">
  13.         <h1 role="heading" aria-level="1">{{ page.pageTitle }}</h1>
  14.         <div class="blog-filter js-toggle-container">
  15.             <div class="blog-filter__top">
  16.                 {#                        {% include 'Pages/NewsOverviewPage/_filter-tag.html.twig' with {'tags': tagContext.tags} %}#}
  17.                 {#                        {% include 'Pages/NewsOverviewPage/_filter-category.html.twig' with {'categories': categoryContext.categories} %}#}
  18.             </div>
  19.             <div class="blog-filter__filters">
  20.                 {% include 'Pages/NewsOverviewPage/_list-tag.html.twig' with {'tagContext': tagContext} %}
  21.                 {#                        {% include 'Pages/NewsOverviewPage/_list-category.html.twig' with {'categoryContext': categoryContext} %}#}
  22.             </div>
  23.         </div>
  24.     </div>
  25.     <div class="content">
  26.         {% set count = 0 %}
  27.         {% if pagerfanta.nbResults > 0 %}
  28.             <div class="row">
  29.                 {% for article in pagerfanta.currentPageResults %}
  30.                     {% set articlenode = get_node_translation_for(article) %}
  31.                     {% if article.listImage and article.listImage is not empty %}
  32.                         {% set img = article.listImage | first %}
  33.                     {% elseif article.headerImage and article.headerImage is not empty %}
  34.                         {% set img = article.headerImage | first %}
  35.                     {% else %}
  36.                         {% set img = {
  37.                             'cropping' : null,
  38.                             'media' : {
  39.                                 'url' : get_default_article_image(),
  40.                             },
  41.                             'mediaAlt' : 'GdyƄskie Centrum Sportu'
  42.                         } %}
  43.                     {% endif %}
  44.                     <article
  45.                             class="news-box col-md-4{% for tag in article.tags %}{% if tag.id == 3 %} photo{% endif %}{% if tag.id == 2 %} video{% endif %}{% endfor %}">
  46.                         <a href="{{ path('_slug', {'url': articlenode.url}) }}">
  47.                             <div class="news-box__img">
  48.                                 {% if img is defined and img is not empty and img is not null %}
  49.                                     {% set fullSrc = croppedImgSrc(img.media.url, img.cropping, { w: 450, h: 300, q: 80, fit: 'crop' }) %}
  50.                                     <img src="{{ fullSrc }}" alt="{% if img.mediaAlt %}{{ img.mediaAlt }}{% else %}{{ article.title | striptags }}{% endif %}" />
  51.                                 {% else %}
  52.                                     <img src="data:image/gif;base64,R0lGODlhAQABAIAAAMLCwgAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw=="
  53.                                          alt="">
  54.                                 {% endif %}
  55.                                 <div class="news-box__read-more">
  56.                                     {{ 'news.read-more' | trans }}
  57.                                 </div>
  58.                             </div>
  59.                             <div class="news-box__caption">
  60.                                 <h3  role="heading" aria-level="3">{{ article.title }}</h3>
  61.                             </div>
  62.                             <div class="news-box__date">
  63.                                 <time datetime="{{ article.date | date("d.m.Y") }}">{{ article.date | date("d.m.Y") }}</time>
  64.                             </div>
  65.                         </a>
  66.                     </article>
  67.                     {% set count = count + 1 %}
  68.                     {% set img = null %}
  69.                 {% endfor %}
  70.             </div>
  71.         {% endif %}
  72.         {% if  pagerfanta.haveToPaginate() %}
  73.             <div class="pagination">
  74.                 {{ pagerfanta(pagerfanta, null, {
  75.                     'pageParameter': '[page]',
  76.                     'prev_message':'<i class="fas fa-chevron-left"></i>',
  77.                     'next_message':'<i class="fas fa-chevron-right"></i>'
  78.                 }) }}
  79.             </div>
  80.         {% endif %}
  81.     </div>
  82. </div>