<?php
//Content
$type = mb_get_block_field("video-section-headline-type");
$headline = mb_get_block_field("video-section-headline");
$text = mb_get_block_field("video-section-text");
$buttons = mb_get_block_field("video-section-buttons");
//Video
$thumbnail = mb_get_block_field("video-section-thumbnail");
$default_thumb = mb_get_block_field("video-section-default-thumb-url");
$play = mb_get_block_field("video-section-play-text");
$src = mb_get_block_field("video-section-src");
$position = mb_get_block_field("video-section-position");
?>
<div <?= inoby_block_attrs($attributes, ["class" => "component-video-section"]) ?>>
  <div class="container">
    <div class="row <?= $position ?>">
      <div class="col-6 col-sm-12">
        <div class="video-wrap">
          <?php
          if ($default_thumb) {
            if ($thumbnail) {
              echo mb_inoby_picture($thumbnail, "v-12", ["sm" => "v-4", "md" => "v-6", "lg" => "v-12"]);
            } else {
              echo "<img src='$default_thumb' alt='Video...' />";
            }
          }
          if ($src) {
            echo '<a class="link link-play glightbox-item" href="' .
              $src .
              '"><svg width="68" height="68" viewBox="0 0 68 68" fill="none" xmlns="http://www.w3.org/2000/svg">
            <rect width="68" height="68" rx="34" fill="#05A597"/>
            <path d="M33.0048 38.0096C32.6824 38.2822 32.1881 38.0572 32.182 37.6351L32.0647 29.5514C32.0585 29.1213 32.5622 28.8846 32.8893 29.1639L37.7043 33.2747C37.9388 33.4749 37.938 33.8376 37.7025 34.0367L33.0048 38.0096Z" fill="white"/>
            </svg>' .
              $play .
              "</a>";
          }
          ?>
        </div>
      </div>
      <div class="col-6 col-sm-12">
        <div class="content-wrap">
          <?php
          if ($type) {
            echo "<" . $type . ">" . $headline . "</" . $type . ">";
          }
          if ($text) {
            echo "<p>" . $text . "</p>";
          }
          if ($buttons) {
            foreach ($buttons as $button) {
              echo '<a class="button" href="' . $button[1] . '" target="' . $button[2] . '">' . $button[0] . "</a>";
            }
          }
          ?>
        </div>
      </div>
    </div>
  </div>
</div>