custom/plugins/AcrisProductVideoCS/src/Resources/views/storefront/component/custom/element/iframe-youtube.html.twig line 1

Open in your IDE?
  1. {% block acris_product_video_iframe_youtube %}
  2.     {% if config('AcrisProductVideoCS.config').hideRelatedVideos == true %}
  3.         {% if '?' in image.translated.link %}
  4.             {% do image.addTranslated('link', image.translated.link~'&rel=0') %}
  5.         {% else %}
  6.             {% do image.addTranslated('link', image.translated.link~'?rel=0') %}
  7.         {% endif %}
  8.     {% endif %}
  9.     {% set previewImageLoading = config('AcrisProductVideoCS.config').previewImageLoading %}
  10.     {% set previewImageUrl = null %}
  11.     {% if image.extensions.acrisProductVideoPreviewImage and image.extensions.acrisProductVideoPreviewImage.media %}
  12.         {% set previewImageUrl = image.extensions.acrisProductVideoPreviewImage.media.url %}
  13.     {% endif %}
  14.     {% set customImg = false %}
  15.     {% if previewImageLoading == 'cookie' %}
  16.         {% set customImg = true %}
  17.     {% endif %}
  18.     {% set productVideoImg = 'https://i.ytimg.com/vi/' ~ image.translated.link|split('/')|last|split('?')|first|trim ~ '/hqdefault.jpg' %}
  19.     {% if image.type == 'youtube' %}
  20.         {% set type = 'youtube' %}
  21.     {% else %}
  22.         {% set type = 'vimeo' %}
  23.     {% endif %}
  24.     {% set productVideoOptions = {
  25.         loadVideoAfterClick: loadVideoAfterClick,
  26.         errorCookieSource: "https://www.youtube-nocookie.com/embed/error",
  27.         noCookieVideo: noCookie|length,
  28.         previewImageLoading: previewImageLoading,
  29.         previewImageUrl: previewImageUrl,
  30.         productVideoId: image.id,
  31.         entry: 'element',
  32.         type: type,
  33.         customImg: customImg,
  34.         currentPreviewImage: productVideoImg,
  35.         originalSource: image.translated.link
  36.     } %}
  37.     <div itemscope itemtype="http://schema.org/VideoObject"
  38.          class="element-product-video-id-{{ image.id }} acris-product-video-item-container is-{{ displayMode }}{% if isImageGallery %} gallery-slider-item-container{% endif %}"{% if minHeight and  (displayMode == "cover" or displayMode == "contain" ) %} style="height: {{ minHeight }}"{% endif %}>
  39.         <meta itemprop="name" content="{{ metaUrlData['title'] }}" />
  40.         <meta itemprop="thumbnailURL" content="{{ metaUrlData['thumbnail_url'] }}" />
  41.         <meta itemprop="uploadDate" content="{{ image.createdAt.format('Y-m-dTH:i:sZ') }}"/>
  42.         <meta itemprop="embedURL" content="{{ image.translated.link }}" />
  43.         <meta itemprop="description" content="{{ metaUrlData['description'] }}" />
  44.         <iframe class="acris-product-video-iframe"
  45.                 title="{{ image.translated.description }}"
  46.                 data-acris-product-video="true"
  47.                 data-acris-product-video-options="{{ productVideoOptions|json_encode }}"
  48.                 src="{{ image.translated.link }}" width="460" height="285" frameborder="0"
  49.                 allowfullscreen="allowfullscreen"
  50.                 mozallowfullscreen="mozallowfullscreen"
  51.                 msallowfullscreen="msallowfullscreen"
  52.                 oallowfullscreen="oallowfullscreen"
  53.                 webkitallowfullscreen="webkitallowfullscreen"></iframe>
  54.     </div>
  55.     {% set loadVideoWithNoCookie = true %}
  56.     {% set loadVideoAfterClick = 'loadAfter' %}
  57.     {% sw_include '@AcrisProductVideoCS/storefront/component/custom/element/iframe-youtube-load-after.html.twig' %}
  58. {% endblock %}