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

Open in your IDE?
  1. {% if element.data.result is empty %}
  2.     <div class="cms-listing-col col-12">
  3.         {% sw_include '@Storefront/storefront/utilities/alert.html.twig' with {
  4.             type: 'info', content: 'netzp.blog.msg.noposts'|trans|sw_sanitize
  5.         } %}
  6.     </div>
  7. {% else %}
  8.     <div class="blog-slider"
  9.          data-product-slider="true"
  10.          data-product-slider-options='{
  11.             "slider": {
  12.                 "gutter": 20,
  13.                 "autoplayButtonOutput": false,
  14.                 "nav": false,
  15.                 "controls": true,
  16.                 "autoplay": false,
  17.                 "mouseDrag": true
  18.             }
  19.          }'>
  20.         <div class="row blog-slider-container m-0 p-0" data-product-slider-container="true">
  21.             {% for post in element.data.result %}
  22.                 {% set postDetailUrl = seoUrl('frontend.blog.post', {'postId': post.id} ) %}
  23.                 {% set paramPage = app.request.get('p') ? 'p=' ~ app.request.get('p') : '' %}
  24.                 {% set paramCategory = app.request.get('c') ? 'c=' ~ app.request.get('c') : '' %}
  25.                 {% set paramAuthor = app.request.get('a') ? 'a=' ~ app.request.get('a') : '' %}
  26.                 {% set urlParams = [paramPage, paramCategory, paramAuthor] | filter(p => p != '') | join('&') %}
  27.                 {% if urlParams %}
  28.                     {% set postDetailUrl = postDetailUrl ~ '?' ~ urlParams %}
  29.                 {% endif %}
  30.                 <div>
  31.                     <div class="card blog-card h-100" style="background-color: {{ element.config.backgroundColor.value }}">
  32.                         {% set image = null %}
  33.                         {% if post.imagepreview %}
  34.                             {% set image = post.imagepreview %}
  35.                         {% elseif post.image %}
  36.                             {% set image = post.image %}
  37.                         {% endif %}
  38.                         {% if image %}
  39.                             {% set thumbnailClass = element.config.imageMode.value == "contain" ? "contain" : "cover" %}
  40.                             <a href="{{ postDetailUrl }}">
  41.                                 {% if image.mediaType.name == 'IMAGE' %}
  42.                                     {% sw_thumbnails 'blog_slider_image_thumbnail' with {
  43.                                         media: image,
  44.                                         sizes: {
  45.                                             'xs': '501px',
  46.                                             'sm': '315px',
  47.                                             'md': '427px',
  48.                                             'lg': '333px',
  49.                                             'xl': '284px'
  50.                                         },
  51.                                         attributes: {
  52.                                             'class': 'card-img-top ' ~ thumbnailClass,
  53.                                             'alt':   image.translated.alt ?: '',
  54.                                             'title': post.translated.title ?: ''
  55.                                         }
  56.                                     } %}
  57.                                 {% elseif image.mediaType.name == 'VIDEO' %}
  58.                                     <video class="video" controls>
  59.                                         <source src="{{ image.url }}" type="{{ image.mimetype }}">
  60.                                         Your browser does not support HTML5 video.
  61.                                     </video>
  62.                                 {% endif %}
  63.                             </a>
  64.                         {% else %}
  65.                             <div class="blog-card-paceholder">&nbsp;</div>
  66.                         {% endif %}
  67.                         <div class="card-body d-flex flex-column p-2">
  68.                             {% block blog_content_post_inner_title %}
  69.                                 <a href="{{ postDetailUrl }}">
  70.                                     <h4 class="mt-2 mb-0">{{ post.translated.title }}</h4>
  71.                                 </a>
  72.                             {% endblock %}
  73.                             {% if element.data.pluginConfig.showmeta %}
  74.                                 {% block blog_content_post_inner_meta %}
  75.                                     {% sw_include "@Storefront/storefront/page/blog/post-meta.html.twig" with { config: element.data.pluginConfig } %}
  76.                                 {% endblock %}
  77.                             {% endif %}
  78.                             {% if post.translated.teaser %}
  79.                                 {% block blog_content_post_inner_teaser %}
  80.                                     <div class="card-text mt-3 mb-1">
  81.                                         {{ post.translated.teaser }}
  82.                                     </div>
  83.                                 {% endblock %}
  84.                             {% endif %}
  85.                             {% block blog_content_post_inner_more %}
  86.                             <div class="mt-auto">
  87.                                 <a href="{{ postDetailUrl }}"
  88.                                    class="btn btn-outline-primary btn-sm mt-2">
  89.                                     {{ "netzp.blog.msg.more"|trans }}
  90.                                 </a>
  91.                             </div>
  92.                             {% endblock %}
  93.                         </div>
  94.                     </div>
  95.                 </div>
  96.             {% endfor %}
  97.         </div>
  98.         <div class="blog-slider-controls-container">
  99.             <div class="base-slider-controls"
  100.                  data-product-slider-controls="true">
  101.                 <button class="base-slider-controls-prev product-slider-controls-prev">
  102.                     {% sw_icon 'arrow-head-left' %}
  103.                 </button>
  104.                 <button class="base-slider-controls-next product-slider-controls-next">
  105.                     {% sw_icon 'arrow-head-right' %}
  106.                 </button>
  107.             </div>
  108.         </div>
  109.     </div>
  110. {% endif %}