custom/plugins/NetzpBlog6/src/Resources/views/storefront/element/blog-index-listitem.html.twig line 1

Open in your IDE?
  1. {% block blog_list_item %}
  2.     {% set postDetailUrl = seoUrl('frontend.blog.post', {'postId': post.id} ) %}
  3.     {% set paramPage = app.request.get('p') ? 'p=' ~app.request.get('p') : '' %}
  4.     {% set paramCategory = app.request.get('c') ? 'c=' ~app.request.get('c') : '' %}
  5.     {% set paramAuthor = app.request.get('a') ? 'a=' ~app.request.get('a') : '' %}
  6.     {% set urlParams = [paramPage, paramCategory, paramAuthor] | filter(p => p != '') | join('&') %}
  7.     {% if urlParams %}
  8.         {% set postDetailUrl = postDetailUrl ~ '?' ~ urlParams %}
  9.     {% endif %}
  10.     <div class="d-flex flex-sm-row flex-column mb-3 blog-list-item" style="background-color: {{ element.config.backgroundColor.value }}">
  11.         {% block blog_list_item_wrapper %}
  12.             <div class="pt-3 pb-3 pl-3">
  13.                 <a href="{{ postDetailUrl }}">
  14.                     {% block blog_content_post_inner_title %}
  15.                         <h4 class="mb-0">{{ post.translated.title }}</h4>
  16.                     {% endblock %}
  17.                 </a>
  18.                 {% if element.data.pluginConfig.showmeta %}
  19.                     {% block blog_content_post_inner_meta %}
  20.                         {% sw_include "@Storefront/storefront/page/blog/post-meta.html.twig" with { config: element.data.pluginConfig } %}
  21.                     {% endblock %}
  22.                 {% endif %}
  23.                 {% if post.translated.teaser %}
  24.                     {% block blog_content_post_inner_teaser %}
  25.                         <div class="lead mt-3 mb-1">
  26.                             {{ post.translated.teaser }}
  27.                         </div>
  28.                     {% endblock %}
  29.                 {% endif %}
  30.                 {% block blog_content_post_inner_more %}
  31.                     <a href="{{ postDetailUrl }}"
  32.                        class="btn btn-outline-primary btn-sm mt-2">
  33.                         {{ "netzp.blog.msg.more"|trans }}
  34.                     </a>
  35.                 {% endblock %}
  36.             </div>
  37.         {% endblock %}
  38.         {% block blog_content_post_inner_image %}
  39.             <div class="ml-0 ml-sm-auto p-0">
  40.                 {% set image = null %}
  41.                 {% if post.imagepreview %}
  42.                     {% set image = post.imagepreview %}
  43.                 {% elseif post.image %}
  44.                     {% set image = post.image %}
  45.                 {% endif %}
  46.                 {% if image %}
  47.                     {% set thumbnailClass = element.config.imageMode.value == "contain" ? "contain" : "cover" %}
  48.                     <a href="{{ postDetailUrl }}">
  49.                         {% if image.mediaType.name == 'IMAGE' %}
  50.                             {% sw_thumbnails 'blog_list_image_thumbnail' with {
  51.                                 media: image,
  52.                                 sizes: {
  53.                                     'xs': '501px',
  54.                                     'sm': '315px',
  55.                                     'md': '427px',
  56.                                     'lg': '333px',
  57.                                     'xl': '284px'
  58.                                 },
  59.                                 attributes: {
  60.                                     'class': 'img-fluid ' ~ thumbnailClass,
  61.                                     'alt':   image.translated.alt ?: '',
  62.                                     'title': post.translated.title ?: ''
  63.                                 }
  64.                             } %}
  65.                         {% elseif image.mediaType.name == 'VIDEO' %}
  66.                             <video class="video {{ thumbnailClass }}" controls>
  67.                                 <source src="{{ image.url }}" type="{{ image.mimetype }}">
  68.                                 Your browser does not support HTML5 video.
  69.                             </video>
  70.                         {% endif %}
  71.                     </a>
  72.                 {% endif %}
  73.             </div>
  74.         {% endblock %}
  75.     </div>
  76. {% endblock %}