custom/plugins/NetzpBlog6/src/Resources/views/storefront/element/blog-index-card.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 false and urlParams %}
  8.         {% set postDetailUrl = postDetailUrl ~ '?' ~ urlParams %}
  9.     {% endif %}
  10.     <div class="col-lg-4 col-sm-6 mb-3">
  11.         {% block blog_list_item_wrapper %}
  12.             <div class="card h-100 blog-card" style="background-color: {{ element.config.backgroundColor.value }}">
  13.                 {% block blog_content_post_inner_image %}
  14.                     {% set image = null %}
  15.                     {% if post.imagepreview %}
  16.                         {% set image = post.imagepreview %}
  17.                     {% elseif post.image %}
  18.                         {% set image = post.image %}
  19.                     {% endif %}
  20.                     {% if image %}
  21.                         {% set thumbnailClass = element.config.imageMode.value == "contain" ? "contain" : "cover" %}
  22.                         <a href="{{ postDetailUrl }}">
  23.                             {% if image.mediaType.name == 'IMAGE' %}
  24.                                 {% sw_thumbnails 'blog_card_image_thumbnail' with {
  25.                                     media: image,
  26.                                     sizes: {
  27.                                         'xs': '501px',
  28.                                         'sm': '315px',
  29.                                         'md': '427px',
  30.                                         'lg': '333px',
  31.                                         'xl': '284px'
  32.                                     },
  33.                                     attributes: {
  34.                                         'class': 'card-img-top ' ~ thumbnailClass,
  35.                                         'alt':   image.translated.alt ?: '',
  36.                                         'title': post.translated.title ?: ''
  37.                                     }
  38.                                 } %}
  39.                             {% elseif image.mediaType.name == 'VIDEO' %}
  40.                                 <video class="video {{ thumbnailClass }}" controls>
  41.                                     <source src="{{ image.url }}" type="{{ image.mimetype }}">
  42.                                     Your browser does not support HTML5 video.
  43.                                 </video>
  44.                             {% endif %}
  45.                         </a>
  46.                     {% else %}
  47.                         <div class="blog-card-paceholder">&nbsp;</div>
  48.                     {% endif %}
  49.                 {% endblock %}
  50.                 <div class="card-body d-flex flex-column p-2">
  51.                     {% block blog_content_post_inner_title %}
  52.                         <a href="{{ postDetailUrl }}">
  53.                             <h4 class="mt-2 mb-0">{{ post.translated.title }}</h4>
  54.                         </a>
  55.                     {% endblock %}
  56.                     {% if element.data.pluginConfig.showmeta %}
  57.                         {% block blog_content_post_inner_meta %}
  58.                             {% sw_include "@Storefront/storefront/page/blog/post-meta.html.twig" with { config: element.data.pluginConfig } %}
  59.                         {% endblock %}
  60.                     {% endif %}
  61.                     {% if post.translated.teaser %}
  62.                         {% block blog_content_post_inner_teaser %}
  63.                             <div class="card-text mt-3 mb-1">
  64.                                 {{ post.translated.teaser }}
  65.                             </div>
  66.                         {% endblock %}
  67.                     {% endif %}
  68.                     {% block blog_content_post_inner_more %}
  69.                         <div class="mt-auto">
  70.                             <a href="{{ postDetailUrl }}"
  71.                                class="btn btn-outline-primary btn-sm mt-2">
  72.                                 {{ "netzp.blog.msg.more"|trans }}
  73.                             </a>
  74.                         </div>
  75.                     {% endblock %}
  76.                 </div>
  77.             </div>
  78.         {% endblock %}
  79.     </div>
  80. {% endblock %}