<?php

class MbVideoSection extends MBComponentBase implements MBRetrievesVideoThumbnails {
  protected function init_options($options) {
    $options->id = "video-section";
    $options->title = "Video sekcia";
    $options->icon = "playlist-video";
    $options->render_template = get_theme_file_path("/components/video-section/template.php");
    $options->fields = [
      [
        "name" => __("Typ nadpisu", "inoby"),
        "id" => "video-section-headline-type",
        "type" => "select_advanced",
        "options" => [
          "h1" => "H1",
          "h2" => "H2",
          "h3" => "H3",
          "h4" => "H4",
          "h5" => "H5",
          "h6" => "H6",
        ],
        "placeholder" => __("Vyberte úroveň", "inoby"),
      ],
      [
        "name" => __("Nadpis", "inoby"),
        "id" => "video-section-headline",
        "type" => "text",
        "sanitize_callback" => "none",
      ],
      [
        "name" => __("Text", "inoby"),
        "id" => "video-section-text",
        "type" => "textarea",
        "sanitize_callback" => "none",
      ],
      [
        "id" => "video-section-buttons",
        "name" => __("Tlačidlá", "inoby"),
        "type" => "text_list",
        "clone" => true,
        "options" => [
          "Zisti viac" => "Text",
          "https://www.google.com/" => "Odkaz",
          "_self" => "target",
        ],
        "add_button" => __("Pridať tlačidlo", "inoby"),
      ],
      [
        "type" => "divider",
      ],
      [
        "name" => __("Náhľadový obrázok", "inoby"),
        "id" => "video-section-thumbnail",
        "type" => "image_advanced",
        "force_delete" => false,
        "max_file_uploads" => 1,
        "max_status" => true,
        "image_size" => "thumbnail",
      ],
      [
        "name" => __("Text tlačidla prehrávania", "inoby"),
        "id" => "video-section-play-text",
        "type" => "text",
      ],
      [
        "name" => __("Odkaz na video", "inoby"),
        "id" => "video-section-src",
        "type" => "text",
      ],
      [
        "id" => "video-section-default-thumb-url",
        "type" => "hidden",
      ],
      [
        "name" => __("Pozícia videa", "inoby"),
        "id" => "video-section-position",
        "type" => "radio",
        "inline" => false,
        "options" => [
          "left" => "Vľavo",
          "right" => "Vpravo",
        ],
      ],
    ];
  }

  public function videoThumbnailFields(): array {
    return [
      "video-section-src" => "video-section-default-thumb-url",
    ];
  }
}
