<?php
$this->start_controls_section(
    'content_section',
    [
        'label' => __('Content', 'ostech-addon'),
        'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
        'condition' => [
            'layout_type' => ['layout_one']
        ]
    ]
);

$this->add_control(
    'layout_one_sec_icon',
    [
        'label' => __('Section Icon', 'ostech-addon'),
        'type' => \Elementor\Controls_Manager::ICONS,
        'default' => [
            'value' => 'ostech-icons-two-logo',
            'library' => 'custom-icon',
        ],
    ]
);

$this->add_control(
    'layout_one_sec_title',
    [
        'label' => __('Section Title', 'ostech-addon'),
        'type' => \Elementor\Controls_Manager::TEXTAREA,
        'placeholder' => __('Add title', 'ostech-addon'),
        'default' => __('Default Title', 'ostech-addon'),
    ]
);

ostech_elementor_heading_option($this, 'Section Title', 'h3', 'layout_one');

$this->add_control(
    'layout_one_sec_sub_title',
    [
        'label' => __('Section Sub Title', 'ostech-addon'),
        'type' => \Elementor\Controls_Manager::TEXTAREA,
        'placeholder' => __('Add sub title', 'ostech-addon'),
        'default' => __('Default Sub Title', 'ostech-addon'),
    ]
);

ostech_elementor_heading_option($this, 'Section Sub Title', 'h6', 'layout_one');

$massage_list = new \Elementor\Repeater();

$massage_list->add_control(
    'tab_title',
    [
        'label' => __('Tab Title', 'ostech-addon'),
        'type' => \Elementor\Controls_Manager::TEXTAREA,
        'placeholder' => __('Add Tab Title', 'ostech-addon'),
        'default' => __('Awesome Tab Title', 'ostech-addon'),
    ]
);

$massage_list->add_control(
    'icon',
    [
        'label' => __('Icon', 'ostech-addon'),
        'type' => \Elementor\Controls_Manager::ICONS,
        'default' => [
            'value' => 'icon-herbal',
            'library' => 'custom-icon',
        ],
    ]
);

$massage_list->add_control(
    'title',
    [
        'label' => __('Title', 'ostech-addon'),
        'type' => \Elementor\Controls_Manager::TEXTAREA,
        'placeholder' => __('Add Title', 'ostech-addon'),
        'default' => __('Awesome Title', 'ostech-addon'),
    ]
);

ostech_elementor_heading_option($massage_list, 'Title', 'h3', 'layout_one');

$massage_list->add_control(
    'sub_title',
    [
        'label' => __('Sub Title', 'ostech-addon'),
        'type' => \Elementor\Controls_Manager::TEXTAREA,
        'placeholder' => __('Add Sub Title', 'ostech-addon'),
        'default' => __('Awesome Sub Title', 'ostech-addon'),
    ]
);

$massage_list->add_control(
    'image',
    [
        'label' => __('Image', 'ostech-addon'),
        'type' => \Elementor\Controls_Manager::MEDIA,
        'default' => [
            'url' => \Elementor\Utils::get_placeholder_image_src(),
        ],
    ]
);

$massage_list->add_control(
    'active_status',
    [
        'label' => __('Is active?', 'ostech-addon'),
        'type' => \Elementor\Controls_Manager::SWITCHER,
        'label_on' => __('Yes', 'ostech-addon'),
        'label_off' => __('No', 'ostech-addon'),
        'return_value' => 'yes',
        'default' => 'no',
    ]
);

$this->add_control(
    'massage_list',
    [
        'label' => __('massage_lists', 'ostech-addon'),
        'type' => \Elementor\Controls_Manager::REPEATER,
        'fields' => $massage_list->get_controls(),
        'prevent_empty' => false,
        'default' => [
            [
                'title' => __('Awesome Title', 'ostech-addon'),
            ],
        ],
        'title_field' => '{{{ title }}}',
    ]
);

$this->add_control(
    'layout_one_bg_image',
    [
        'label' => __('Background Image', 'ostech-addon'),
        'type' => \Elementor\Controls_Manager::MEDIA,
        'default' => [
            'url' => \Elementor\Utils::get_placeholder_image_src(),
        ],
    ]
);

$this->end_controls_section();
