<?php

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


$testimonial = new \Elementor\Repeater();

$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($testimonial, 'Testimonial Name', 'h3', 'layout_one');

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

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

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

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

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

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


$this->end_controls_section();
