<?php

add_filter("rwmb_meta_boxes", function ($meta_boxes) {
  $meta_boxes[] = [
    "id" => "mt_page",
    "title" => __("Stránka s odsekmi", "rootscope"),
    "post_types" => ["page"],
    "show" => [
      "template" => ["page-templates/multitab-page.php"],
    ],
    "context" => "normal",
    "priority" => "default",
    "autosave" => "false",
    "fields" => [
      [
        "name" => __("Show page title", "rootscope"),
        "id" => "mt_page_show_title",
        "type" => "checkbox",
        "std" => 0,
      ],
      [
        "name" => __("Show page content", "rootscope"),
        "id" => "mt_page_show_content",
        "type" => "checkbox",
        "std" => 0,
      ],
      [
        "group_title" => "Odsek {mt_page_tab_title}",
        "id" => "mt_page_tabs",
        "type" => "group",
        "clone" => true,
        "collapsible" => true,
        "default_state" => "collapsed",
        "sort_clone" => true,
        "fields" => [
          [
            "name" => __("Nadpis", "rootscope"),
            "id" => "mt_page_tab_title",
            "type" => "text",
            "translate" => true,
          ],
          [
            "name" => __("Text", "rootscope"),
            "id" => "mt_page_tab_text",
            "type" => "wysiwyg",
            "translate" => true,
            "sanitize_callback" => "none",
          ],
          [
            "name" => __("Galéria", "rootscope"),
            "id" => "mt_page_tab_images",
            "type" => "image_upload",
            "image_size" => "thumbnail",
          ],
        ],
      ],
    ],
  ];
  return $meta_boxes;
});