custom/plugins/NetzpBlog6/src/Resources/views/storefront/page/blog/post-media.html.twig line 1

Open in your IDE?
  1. {% if post.blogmedia|length > 0 %}
  2.     <div class="blog-media" id="blog-media-gallery_{{ element.id }}">
  3.         {% for media in post.blogmedia %}
  4.             {% block netzp_blog_media_item %}
  5.                 <div>
  6.                     {% if media.media %}
  7.                         {% set height = element.config.height.value ?? 12 %}
  8.                         {% set subHtml = element.config.showGalleryCaption.value ? media.media.translated.title : '' %}
  9.                         {% set thumbnailClass = 'type-image img-fluid' %}
  10.                         {% set thumbnailStyle = 'height: ' ~ height ~ 'rem; width: ' ~ height ~ 'rem;' %}
  11.                         {% if media.media.mediatype.name == 'VIDEO' %}
  12.                             {% block netzp_blog_media_item_video %}
  13.                                 <div class="item">
  14.                                     {% block netzp_blog_media_item_video_element %}
  15.                                         <div data-html="#video_{{ loop.index }}"
  16.                                              data-sub-html="{{ subHtml }}"
  17.                                              class="lightbox type-video" style="{{ thumbnailStyle }}"
  18.                                              alt="{{ media.media.translated.alt }}" title="{{ media.media.translated.title }}">
  19.                                             {% sw_icon 'video-camera' style { 'size': 'lg' } %}
  20.                                             <div class="file-extension">{{ media.media.fileExtension|upper }}</div>
  21.                                         </div>
  22.                                     {% endblock %}
  23.                                     {% block netzp_blog_media_item_video_caption %}
  24.                                         {% if element.config.showThumbnailCaption.value and media.media.translated.title %}
  25.                                             <div class="caption" style="max-width: {{ height }}rem">{{ media.media.translated.title }}</div>
  26.                                         {% endif %}
  27.                                     {% endblock %}
  28.                                 </div>
  29.                             {% endblock %}
  30.                         {% elseif media.media.mediatype.name == 'DOCUMENT' %}
  31.                             {% block netzp_blog_media_item_document %}
  32.                                 <div class="item">
  33.                                     {% block netzp_blog_media_item_document_element %}
  34.                                         <a href="{{ media.media.url }}" download
  35.                                            alt="{{ media.media.translated.alt }}"
  36.                                            title="{{ media.media.translated.title }}">
  37.                                             <div class="type-document" style="{{ thumbnailStyle }}"
  38.                                                  alt="{{ media.media.translated.alt }}" title="{{ media.media.translated.title }}">
  39.                                                 {% sw_icon 'file' style { 'size': 'lg' } %}
  40.                                                 <div class="file-extension">{{ media.media.fileExtension|upper }}</div>
  41.                                                 <div class="download-icon">
  42.                                                     {% sw_icon 'cloud-download' style { 'size': 'sm' } %}
  43.                                                 </div>
  44.                                             </div>
  45.                                         </a>
  46.                                     {% endblock %}
  47.                                     {% block netzp_blog_media_item_document_caption %}
  48.                                         {% if element.config.showThumbnailCaption.value and media.media.translated.title %}
  49.                                             <div class="caption" style="max-width: {{ height }}rem">{{ media.media.translated.title }}</div>
  50.                                         {% endif %}
  51.                                     {% endblock %}
  52.                                 </div>
  53.                             {% endblock %}
  54.                         {% elseif media.media.mediatype.name == 'AUDIO' %}
  55.                             {% block netzp_blog_media_item_audio %}
  56.                                 <div class="item">
  57.                                     {% block netzp_blog_media_item_audio_element %}
  58.                                         <a href="{{ media.media.url }}" download
  59.                                            alt="{{ media.media.translated.alt }}"
  60.                                            title="{{ media.media.translated.title }}">
  61.                                             <div class="type-audio" style="{{ thumbnailStyle }}"
  62.                                                  alt="{{ media.media.translated.alt }}" title="{{ media.media.translated.title }}">
  63.                                                 {% sw_icon 'micophone' style { 'size': 'lg' } %}
  64.                                                 <div class="file-extension">{{ media.media.fileExtension|upper }}</div>
  65.                                             </div>
  66.                                         </a>
  67.                                     {% endblock %}
  68.                                     {% block netzp_blog_media_item_audio_caption %}
  69.                                         {% if element.config.showThumbnailCaption.value and media.media.translated.title %}
  70.                                             <div class="caption" style="max-width: {{ height }}rem">{{ media.media.translated.title }}</div>
  71.                                         {% endif %}
  72.                                     {% endblock %}
  73.                                 </div>
  74.                             {% endblock %}
  75.                         {% elseif media.media.mediatype.name == 'IMAGE' %}
  76.                             {% block netzp_blog_media_item_image %}
  77.                                 <div class="item">
  78.                                     {% block netzp_blog_media_item_image_element %}
  79.                                         <a href="{{ media.media.url }}" data-sub-html="{{ subHtml }}" class="lightbox">
  80.                                             {% sw_thumbnails 'blog_detail_media_image_thumbnail' with {
  81.                                                 media: media.media,
  82.                                                 sizes: {
  83.                                                     'xs': '501px',
  84.                                                     'sm': '315px',
  85.                                                     'md': '427px',
  86.                                                     'lg': '333px',
  87.                                                     'xl': '284px',
  88.                                                     'default': '100vw'
  89.                                                 },
  90.                                                 attributes: {
  91.                                                     'class': thumbnailClass,
  92.                                                     'style': thumbnailStyle,
  93.                                                     'alt':   media.media.translated.alt,
  94.                                                     'title': media.media.translated.title
  95.                                                 }
  96.                                             } %}
  97.                                         </a>
  98.                                     {% endblock %}
  99.                                     {% block netzp_blog_media_item_image_caption %}
  100.                                         {% if element.config.showThumbnailCaption.value and media.media.translated.title %}
  101.                                             <div class="caption" style="max-width: {{ height }}rem">
  102.                                                 {{ media.media.translated.title }}
  103.                                             </div>
  104.                                         {% endif %}
  105.                                     {% endblock %}
  106.                                 </div>
  107.                             {% endblock %}
  108.                         {% endif %}
  109.                     {% endif %}
  110.                 </div>
  111.             {% endblock %}
  112.         {% endfor %}
  113.     </div>
  114.     {% for media in post.blogmedia %}
  115.         {% if media.media %}
  116.             {% if media.media.mediatype.name == 'VIDEO' %}
  117.                 <div style="display: none" id="video_{{ loop.index }}">
  118.                     <video class="lg-video-object lg-html5" controls preload="none">
  119.                         <source src="{{ media.media.url }}" type="{{ media.media.mimetype }}">
  120.                         Your browser does not support HTML5 video.
  121.                     </video>
  122.                 </div>
  123.             {% endif %}
  124.         {% endif %}
  125.     {% endfor %}
  126.     <template data-netzp-blog-gallery data-netzp6-blog-gallery-options='{
  127.         "selectorId": "blog-media-gallery_{{ element.id }}",
  128.         "selector": ".lightbox",
  129.         "download": false,
  130.         "captionFromTitleOrAlt": false,
  131.         "counter": {{ element.config.showGalleryCounter.value ? 'true' : 'false' }}
  132.     }'></template>
  133. {% endif %}