templates/blocks/framework_hero_video.html.twig line 1

Open in your IDE?
  1. {#
  2.     {
  3.         "key": "framework_hero_video",
  4.         "category": "Framework",
  5.         "label": "Hero (Video)",
  6.         "description": "...",
  7.         "allowMove": false,
  8.         "blocks": [
  9.             {
  10.                 "key": "block-0",
  11.                 "size": 12,
  12.                 "required": "none",
  13.                 "buttons": true,
  14.                 "fields": [
  15.                     {
  16.                         "key": "title",
  17.                         "type": "text",
  18.                         "label": "Titel"
  19.                     },
  20.                     {
  21.                         "key": "content",
  22.                         "type": "textarea",
  23.                         "label": "Content"
  24.                     },
  25.                     {
  26.                         "key": "video",
  27.                         "type": "text",
  28.                         "label": "Video URL (link naar bestand vanuit media-bibliotheek)"
  29.                     }
  30.                 ]
  31.             },
  32.             {
  33.                 "key": "block-1",
  34.                 "size": 12,
  35.                 "required": "media",
  36.                 "fields": []
  37.             }
  38.         ]
  39.     }
  40. #}
  41. <section id="{{wrapper.cssId is defined ? wrapper.cssId : ''}}" class="hero video {{wrapper.cssClass is defined ? wrapper.cssClass : ''}}" style="{% if wrapper.bgColor %}background-color: {{wrapper.bgColor}};{% endif %}">
  42.   <div class="videowrapper">
  43.     <div class="videocontainer">
  44.       {#
  45.       {% if wrapper.blocks[1].media %}
  46.         <div class="imagecontainer" style="background: url(/{{wrapper.blocks[1].media.getWebPath}}) no-repeat center; background-size: cover;"></div>
  47.       {% endif %}
  48.       #}
  49.       {% if firstBlock.config.video is not empty %}
  50.         <video playsinline="playsinline" muted="muted" class="video-js" loop="" autoplay="true" type="video/mp4" data-radium="true" {% if wrapper.blocks[1].media %} poster="/{{wrapper.blocks[1].media.getWebPath}}" {% endif %}>
  51.           <source data-src="{{firstBlock.config.video}}" type="video/mp4"/>
  52.         </video>
  53.         <script>
  54.           if ($(window).width() > 768) {
  55.             var sources = document.querySelectorAll('video.video-js source');
  56.             // Define the video object this source is contained inside
  57.             var video = document.querySelector('video.video-js');
  58.             for (var i = 0; i < sources.length; i++) {
  59.               sources[i].setAttribute('src', sources[i].getAttribute('data-src'));
  60.             }
  61.             // If for some reason we do want to load the video after, for desktop as opposed to mobile (I'd imagine), use videojs API to load
  62.             video.load();
  63.           }
  64.         </script>
  65.       {% endif %}
  66.     </div>
  67.     <div class="titles">
  68.       <div class="vwrapper">
  69.         <div class="valign">
  70.           <div class="container">
  71.             <h1>{{firstBlock.config.title}}</h1>
  72.             {% if firstBlock.config.content is not empty %}
  73.               <div class="text">
  74.                 {{firstBlock.config.content|raw}}
  75.               </div>
  76.             {% endif %}
  77.             {% for b in wrapper.blocks %}
  78.                 {% if b.config.buttons is defined %}
  79.                 <div class="btns">
  80.                   {% for button in b.config.buttons %}
  81.                     <a href="{{button.url}}" {% if button.target is defined and button.target != 'null' and button.target is not empty %} target="{{button.target}}" {% endif %} class="btn {{button.class}}">
  82.                       {{button.label}}
  83.                       <i class="fa fa-angle-right"></i>
  84.                     </a>
  85.                   {% endfor %}
  86.                 </div>
  87.                 {% endif %}
  88.             {% endfor %}
  89.           </div>
  90.         </div>
  91.       </div>
  92.     </div>
  93.   </div>
  94. </section>