<?php

class MBContactBoxes extends MBComponentBase {
  protected function init_options($options) {
    $options->enabled = true;
    $options->id = "inoby-contact-boxes";
    $options->title = __("Kontaktné boxy", "inoby");
    $options->icon = "dashicons dashicons-grid-view";
    $options->render_template = get_theme_file_path("components/contact-boxes/template.php");
    $options->fields = [
      [
        'name'    => 'Počet stĺpcov',
        'id'      => 'contact-box-columns',
        'type'    => 'radio',
        'inline'  => false,
        'options' => [
            '1' => __('1 stĺpec', 'inoby'),
            '2' => __('2 stĺpce', 'inoby'),
            '3' => __('3 stĺpce', 'inoby'),
            '4' => __('4 stĺpce', 'inoby'),
        ],
      ],
      [
        'group_title'   => __('Box {#}', 'inoby'),
        'id'            => 'contact-boxes',
        'type'          => 'group',
        'clone'         => true,
        'collapsible'   => true,
        'default_state' => 'collapsed',
        'sort_clone'    => true,
        'add_button'    => __('Pridať ďalší box', 'inoby'),
        'fields' => array(
          [
            'id'       => 'headline',
            'title'    => __('Nadpis', 'inoby'),
            'placeholder'   => __('Vložte nadpis', 'inoby'),
            'type'     => 'text',
            'sanitize_callback' => 'none',
          ],
          [
            'id'       => 'text',
            'title'    => __('Text', 'inoby'),
            'placeholder'   => __('Vložte text', 'inoby'),
            'type'     => 'wysiwyg',
            'sanitize_callback' => 'none',
          ],
          [
            'group_title'   => __('Osoba {#}', 'inoby'),
            'id'            => 'persons',
            'type'          => 'group',
            'clone'         => true,
            'collapsible'   => true,
            'default_state' => 'collapsed',
            'sort_clone'    => true,
            'add_button'    => __('Pridať ďalšiu Osobu', 'inoby'),
            'fields' => array(
              [
                'id'       => 'person_text',
                'title'    => __('Text', 'inoby'),
                'placeholder'   => __('Vložte text', 'inoby'),
                'type'     => 'wysiwyg',
                'sanitize_callback' => 'none',
              ],
              [
                'id'       => 'name',
                'title'    => __('Meno a priezvisko', 'inoby'),
                'placeholder'   => __('Meno a priezvisko', 'inoby'),
                'type'     => 'text',
              ],
              [
                'id'       => 'email',
                'title'    => __('Email', 'inoby'),
                'placeholder'   => __('Email', 'inoby'),
                'type'     => 'text',
              ],
              [
                'id'       => 'phone_number',
                'title'    => __('Telefón', 'inoby'),
                'placeholder'   => __('Telefónne číslo', 'inoby'),
                'type'     => 'text',
              ],
              [
                'id'               => "person_img",
                'name'             => __('Fotka osoby', 'inoby'),
                'type'             => 'image_advanced',
                'force_delete'     => false,
                'max_file_uploads' => 1,
                'max_status'       => false,
                'image_size'       => 'thumbnail',
              ],
            )
          ],
        )
      ],
    ];
  }
}