<?php

$this->start_controls_section(
    'layout_four_content_section',
    [
        'label' => __('Content', 'ostech-addon'),
        'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
        'condition' => [
            'layout_type' => 'layout_four'
        ]
    ]
);

$layout_four_testimonial = new \Elementor\Repeater();

$layout_four_testimonial->add_control(
    'name',
    [
        'label' => __('Name', 'ostech-addon'),
        'type' => \Elementor\Controls_Manager::TEXT,
        'default' => __('Kevin martin', 'ostech-addon'),
        'label_block' => true
    ]
);

ostech_elementor_heading_option($layout_four_testimonial, 'Testimonial Title', 'h3', 'layout_four');

$layout_four_testimonial->add_control(
    'designation',
    [
        'label' => __('Designation', 'ostech-addon'),
        'type' => \Elementor\Controls_Manager::TEXT,
        'default' => __('Customer', 'ostech-addon'),
        'label_block' => true
    ]
);

$layout_four_testimonial->add_control(
    'testimonial',
    [
        'label' => __('Testimonial', 'ostech-addon'),
        'type' => \Elementor\Controls_Manager::TEXTAREA,
        'default' => __('Default Testimonial Content', 'ostech-addon'),
    ]
);

$layout_four_testimonial->add_control(
    'rating',
    [
        'label' => __('Rating', 'ostech-addon'),
        'type' => \Elementor\Controls_Manager::SLIDER,
        'size_units' => ['count'],
        'range' => [
            'count' => [
                'min' => 1,
                'max' => 5,
                'step' => 1,
            ],
        ],
        'default' => [
            'unit' => 'count',
            'size' => 5,
        ],
    ]
);

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

$this->add_control(
    'layout_four_testimonials',
    [
        'label' => __('Testimonial Items', 'ostech-addon'),
        'prevent_empty' => false,
        'type' => \Elementor\Controls_Manager::REPEATER,
        'fields' => $layout_four_testimonial->get_controls(),
        'title_field' => '{{{ name }}}',
    ]
);

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

$this->end_controls_section();
