<?php

class MBText extends MBComponentBase {
  protected function init_options($options) {
    $options->enabled = true;
    $options->id = "inoby-text";
    $options->title = __("Text", "inoby");
    $options->icon = "editor-justify";
    $options->render_template = get_theme_file_path(
      "components/text/template.php",
    );
    $options->fields = [
      [
        "name" => __("Typ textu", "inoby"),
        "id" => "text_type",
        "type" => "select_advanced",
        "options" => [
          "h1" => "Nadpis <h1>",
          "h2" => "Nadpis <h2>",
          "h3" => "Nadpis <h3>",
          "h4" => "Nadpis <h4>",
          "h5" => "Nadpis <h5>",
          "h6" => "Nadpis <h6>",
          "p" => "Paragraf <p>",
          "strong" => "Tučné písmo <strong>",
          "small" => "Malé písmo <small>",
          "span" => "Jednoduchý text <span>",
        ],
        "placeholder" => "Vyberte typ textu",
      ],
      [
        "id" => "text_content",
        "name" => __("Obsah", "inoby"),
        "placeholder" => __("Vložte obsah", "inoby"),
        "type" => "textarea",
        "sanitize_callback" => "none",
        "translate" => true,
      ],
      [
        "type" => "divider",
      ],
      [
        "name" => __("Zarovnanie", "inoby"),
        "id" => "text_align",
        "type" => "select_advanced",
        "options" => [
          "text-align: left;" => "Vľavo",
          "text-align: center;" => "Na stred",
          "text-align: right;" => "Vpravo",
        ],
        "placeholder" => "Vyberte zarovnanie",
      ],
      [
        "name" => __("Farba", "inoby"),
        "id" => "text_color",
        "type" => "color",
        "alpha_channel" => true,
      ],
      [
        "name" => __("Maximálna šírka (v px)", "inoby"),
        "id" => "text_max_width",
        "type" => "number",
        "min" => 300,
        "max" => 1366,
        "step" => 1,
      ],
      [
        "name" => __("Zarovnanie bloku", "inoby"),
        "id" => "text_align_item",
        "type" => "select_advanced",
        "visible" => ["text_max_width", ">", 0],
        "options" => [
          "margin-right: auto;" => "Vľavo",
          "margin: 0 auto;" => "Na stred",
          "margin-left: auto;" => "Vpravo",
        ],
        "placeholder" => "Vyberte zarovnanie",
      ],
    ];

    $options->preview = [
      "text_type" => "p",
      "text_content" => "Lorem ipsum dolor sit amet consectetur adipisicing elit. Assumenda eaque impedit nostrum suscipit unde nisi nobis, tenetur quo, inventore adipisci cum animi aspernatur! Debitis ullam vel eveniet? Nostrum, veritatis odio.",
    ];
  }
}