<?php

class MBImage extends MBComponentBase {
  protected function init_options($options) {
    $options->enabled = true;
    $options->id = "inoby-image";
    $options->title = __("Obrázok", "inoby");
    $options->icon = "format-image";
    $options->render_template = get_theme_file_path("components/image/template.php");
    $image_sizes = [
      "o-12" => __("Originál - Veľký", "inoby"),
      "o-6" => __("Originál - Stredný", "inoby"),
      "o-4" => __("Originál - Malý", "inoby"),
      "o-2" => __("Originál - Miniatúra", "inoby"),
      "s-12" => __("1:1 - Veľký", "inoby"),
      "h-12" => __("4:3 - Veľký", "inoby"),
      "v-12" => __("3:4 - Veľký", "inoby"),
      "s-6" => __("1:1 - Stredný", "inoby"),
      "h-6" => __("4:3 - Stredný", "inoby"),
      "v-6" => __("3:4 - Stredný", "inoby"),
      "s-4" => __("1:1 - Malý", "inoby"),
      "h-4" => __("4:3 - Malý", "inoby"),
      "v-4" => __("3:4 - Malý", "inoby"),
      "s-2" => __("1:1 - Miniatúra", "inoby"),
      "h-2" => __("4:3 - Miniatúra", "inoby"),
      "v-2" => __("3:4 - Miniatúra", "inoby"),
    ];
    $options->fields = [
      [
        'id'               => "component_image",
        'title'             => __('Obrázok', 'inoby'),
        'type'             => 'image_advanced',
        'force_delete'     => false,
        'max_file_uploads' => 1,
        'max_status'       => false,
        'image_size'       => 'thumbnail',
      ],
      [
        "id" => "component_image_size_d",
        "type" => "select",
        "name" => __("Veľkosť obrázku na desktope", "inoby"),
        'std'  => 's-12',
        "options" => $image_sizes,
      ],
      [
        "id" => "component_image_size_tb",
        "type" => "select",
        "name" => __("Veľkosť obrázku na tablete", "inoby"),
        'std'  => 's-12',
        "options" => $image_sizes,
      ],
      [
        "id" => "component_image_size_mb",
        "type" => "select",
        "name" => __("Veľkosť obrázku na mobile", "inoby"),
        'std'  => 's-12',
        "options" => $image_sizes,
      ],
      [
        'name'      => __('Šírka obrázku', 'inoby'),
        'id'         => "component_image_width",
        'type'       => 'slider',
        'js_options' => [
            'min'   => 1,
            'max'   => 12,
            'step'  => 1,
        ],
        'std' => 12,
      ],
      [
        'name'           => __('Zarovnanie', 'inoby'),
        'id'              => 'component_image_align',
        'type'            => 'select_advanced',
        'options'         => [
            'justify-content: flex-start;'          => 'Vľavo',
            'justify-content: center;'          => 'Na stred',
            'justify-content: flex-end;'          => 'Vpravo',
        ],
        'placeholder'     => 'Vyberte zarovnanie',
      ],
      [
        'name'      => __('Zaoblenie rohov (v px)', 'inoby'),
        'id'              => 'component_image_br',
        'type' => 'number',
        'min'   => 1,
        'max'   => 1000,
        'step'  => 1,
      ],
    ];
  }
}