<?php
// Register Video Player Widget
pxl_add_custom_widget(
    array(
        'name' => 'pxl_play_video',
        'title' => esc_html__('Case Play Video', 'solarva' ),
        'icon' => 'eicon-play',
        'categories' => array('pxltheme-core'),
        'scripts' => array(
            'tilt',
        ),
        'params' => array(
            'sections' => array(
                array(
                    'name' => 'section_content',
                    'label' => esc_html__('Content', 'solarva' ),
                    'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
                    'controls' => array(
                        array(
                            'name' => 'image',
                            'label' => esc_html__('Upload', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::MEDIA,
                        ),
                        array(
                            'name' => 'video_link',
                            'label' => esc_html__('Link', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::TEXT,
                            'default' => 'https://www.youtube.com/watch?v=SF4aHwxHtZ0'
                        ),
                        array(
                            'name' => 'pxl_icon',
                            'label' => esc_html__('Button Icon', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::ICONS,
                            'fa4compatibility' => 'icon',
                        ),
                    ),
                ),

                array(
                    'name' => 'section_style',
                    'label' => esc_html__('General', 'solarva' ),
                    'tab' => \Elementor\Controls_Manager::TAB_STYLE,
                    'controls' => array(
                        array(
                            'name' => 'background_position',
                            'label' => esc_html__('Position', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::SELECT,
                            'control_type' => 'responsive',
                            'default' => '',
                            'options' => [
                                '' => esc_html__('Default', 'solarva'),
                                'center center' => esc_html__('Center Center', 'solarva'),
                                'center left' => esc_html__('Center Left', 'solarva'),
                                'center right' => esc_html__('Center Right', 'solarva'),
                                'top center' => esc_html__('Top Center', 'solarva'),
                                'top left' => esc_html__('Top Left', 'solarva'),
                                'top right' => esc_html__('Top Right', 'solarva'),
                                'bottom center' => esc_html__('Bottom Center', 'solarva'),
                                'bottom left' => esc_html__('Bottom Left', 'solarva'),
                                'bottom right' => esc_html__('Bottom Right', 'solarva'),
                                'custom' => esc_html__('Custom', 'solarva'),
                            ],
                            'selectors' => [
                                '{{WRAPPER}} .pxl-play-video .pxl-item--bg' => 'background-position: {{VALUE}};',
                            ],
                        ),
                        array(
                            'name' => 'bg_repeat',
                            'label' => esc_html__('Repeat', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::SELECT,
                            'control_type' => 'responsive',
                            'default' => '',
                            'options' => [
                                '' => esc_html__('Dafault', 'solarva'),
                                'no-repeat' => esc_html__('No Repeat', 'solarva'),
                                'repeat' => esc_html__('Repeat', 'solarva'),
                                'repeat-x' => esc_html__('Repeat X', 'solarva'),
                                'repeat-y' => esc_html__('Repeat Y', 'solarva'),
                            ],
                            'selectors' => [
                                '{{WRAPPER}} .pxl-play-video .pxl-item--bg' => 'background-repeat: {{VALUE}};',
                            ],
                        ),
                        array(
                            'name' => 'bg_size',
                            'label' => esc_html__('Repeat', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::SELECT,
                            'control_type' => 'responsive',
                            'default' => '',
                            'options' => [
                                '' => esc_html__('Dafault', 'solarva'),
                                'auto' => esc_html__('Auto', 'solarva'),
                                'cover' => esc_html__('Cover', 'solarva'),
                                'contain' => esc_html__('Contain', 'solarva'),
                            ],
                            'selectors' => [
                                '{{WRAPPER}} .pxl-play-video .pxl-item--bg' => 'background-size: {{VALUE}};',
                            ],
                        ),
                        array(
                            'name' => 'height',
                            'label' => esc_html__('Height', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::SLIDER,
                            'control_type' => 'responsive',
                            'size_units' => [ 'px', '%' ],
                            'range' => [
                                'px' => [
                                    'min' => 0,
                                    'max' => 3000,
                                ],
                            ],
                            'selectors' => [
                                '{{WRAPPER}} .pxl-play-video .pxl-item--bg' => 'height: {{SIZE}}{{UNIT}};',
                            ],
                        ),
                    ),
                ),
                array(
                    'name' => 'section_style_overlay',
                    'label' => esc_html__('Overlay', 'solarva' ),
                    'tab' => \Elementor\Controls_Manager::TAB_STYLE,
                    'controls' => array(
                        array(
                            'name' => 'overlay',
                            'label' => esc_html__('Show/Hide', 'solarva'),
                            'type' => \Elementor\Controls_Manager::SWITCHER,
                            'default' => '',
                        ),
                        array(
                            'name' => 'overlay_color',
                            'label' => esc_html__('Background Color', 'solarva'),
                            'type' => \Elementor\Group_Control_Background::get_type(),
                            'control_type' => 'group',
                            'condition' => [
                                'overlay!' => '',
                            ],
                            'selector' => '{{WRAPPER}} .pxl-play-video .pxl-item--overlay',
                        ),
                    ),
                ),
                array(
                    'name' => 'section_style_button',
                    'label' => esc_html__('Button', 'solarva' ),
                    'tab' => \Elementor\Controls_Manager::TAB_STYLE,
                    'controls' => array(
                        array(
                            'name' => 'btn_normal',
                            'label' => esc_html__('NORMAL', 'solarva'),
                            'type' => \Elementor\Controls_Manager::HEADING,
                        ),
                        array(
                            'name' => 'btn_color',
                            'label' => esc_html__('Color', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::COLOR,
                            'selectors' => [
                                '{{WRAPPER}} .pxl-play-video .pxl-btn-play' => 'color: {{VALUE}};',
                                '{{WRAPPER}} .pxl-play-video .pxl-btn-play svg path' => 'fill: {{VALUE}};'
                            ],
                        ),
                        array(
                            'name' => 'btn_color_hover',
                            'label' => esc_html__('Color Hover', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::COLOR,
                            'selectors' => [
                                '{{WRAPPER}} .pxl-play-video .pxl-btn-play:hover' => 'color: {{VALUE}};',
                                '{{WRAPPER}} .pxl-play-video .pxl-btn-play:hover svg path' => 'fill: {{VALUE}};'
                            ],
                        ),
                        array(
                            'name' => 'btn_bg_color',
                            'label' => esc_html__('Background Color', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::COLOR,
                            'selectors' => [
                                '{{WRAPPER}} .pxl-play-video .pxl-btn-play' => 'background-color: {{VALUE}};',
                            ],
                        ),
                        array(
                            'name' => 'btn_bg_color_hover',
                            'label' => esc_html__('Background Color Hover', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::COLOR,
                            'selectors' => [
                                '{{WRAPPER}} .pxl-play-video .pxl-btn-play:hover' => 'background-color: {{VALUE}};',
                            ],
                        ),
                        array(
                            'name' => 'btn_border',
                            'label' => esc_html__('Border', 'solarva' ),
                            'type' => \Elementor\Group_Control_Border::get_type(),
                            'control_type' => 'group',
                            'selector' => '{{WRAPPER}} .pxl-play-video .pxl-btn-play',
                        ),
                        array(
                            'name' => 'btn_font_size',
                            'label' => esc_html__('Font Size', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::SLIDER,
                            'size_units' => [ 'px','%','em','rem', 'custom' ],
                            'control_type' => 'responsive',
                            'range' => [
                                'px' => [
                                    'min' => 1,
                                    'max' => 1000,
                                ],
                            ],
                            'selectors' => [
                                '{{WRAPPER}} .pxl-play-video .pxl-btn-play' => 'font-size: {{SIZE}}{{UNIT}};',
                                '{{WRAPPER}} .pxl-play-video .pxl-btn-play svg' => 'width: {{SIZE}}{{UNIT}};height: {{SIZE}}{{UNIT}}',
                            ],
                        ),
                        array(
                            'name' => 'btn_size',
                            'label' => esc_html__('Box Size', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::SLIDER,
                            'size_units' => [ 'px','%','em','rem', 'custom' ],
                            'control_type' => 'responsive',
                            'range' => [
                                'px' => [
                                    'min' => 1,
                                    'max' => 1000,
                                ],
                            ],
                            'selectors' => [
                                '{{WRAPPER}} .pxl-play-video .pxl-btn-play' => '--size: {{SIZE}}{{UNIT}};',
                            ],
                        ),
                        array(
                            'name' => 'divider3',
                            'type' => \Elementor\Controls_Manager::DIVIDER,
                        ),
                        array(
                            'name' => 'btn_outer_border',
                            'label' => esc_html__('OUTER BORDER', 'solarva'),
                            'type' => \Elementor\Controls_Manager::HEADING,
                        ),
                        array(
                            'name' => 'outer_border',
                            'label' => esc_html__('Border', 'solarva' ),
                            'type' => \Elementor\Group_Control_Border::get_type(),
                            'control_type' => 'group',
                            'selector' => '{{WRAPPER}} .pxl-play-video .pxl-btn-play:before, {{WRAPPER}} .pxl-play-video .pxl-btn-play:after',
                        ),
                        array(
                            'name' => 'divider2',
                            'type' => \Elementor\Controls_Manager::DIVIDER,
                        ),
                        array(
                            'name' => 'btn_positon',
                            'label' => esc_html__('POSITION', 'solarva'),
                            'type' => \Elementor\Controls_Manager::HEADING,
                        ),
                        array(                            
                            'name' => 'h_orientation',
                            'label' => esc_html__('Horizontal Orientation', 'solarva'),
                            'type' => \Elementor\Controls_Manager::CHOOSE,
                            'control_type' => 'responsive',
                            'options' => [
                                'left' => [
                                    'label' => esc_html__('Left', 'solarva'), 
                                    'icon' => 'eicon-h-align-left'
                                ],
                                'right' => [
                                    'label' => esc_html__('Right', 'solarva'), 
                                    'icon' => 'eicon-h-align-right'
                                ],
                            ],
                            'selectors' => [
                                '{{WRAPPER}} .pxl-play-video .pxl-item--btn' => '{{VALUE}}: 0;',
                            ],
                        ),
                        array(
                            'name' => 'offset_left',
                            'label' => esc_html__('Left', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::SLIDER,
                            'size_units' => [ 'px','%','em','rem', 'custom' ],
                            'control_type' => 'responsive',
                            'default' => [
                                'unit' => 'px',
                                'size' => 0,
                            ],
                            'range' => [
                                'px' => [
                                    'min' => 1,
                                    'max' => 1000,
                                ],
                            ],
                            'condition' => [
                                'h_orientation' => 'left',
                            ],
                            'selectors' => [
                                '{{WRAPPER}} .pxl-play-video .pxl-item--btn' => 'left: {{SIZE}}{{UNIT}};right: auto;',
                            ],
                        ),
                        array(
                            'name' => 'offset_right',
                            'label' => esc_html__('Right', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::SLIDER,
                            'size_units' => [ 'px','%','em','rem', 'custom' ],
                            'control_type' => 'responsive',
                            'default' => [
                                'unit' => 'px',
                                'size' => 0,
                            ],
                            'range' => [
                                'px' => [
                                    'min' => 1,
                                    'max' => 1000,
                                ],
                            ],
                            'condition' => [
                                'h_orientation' => 'right',
                            ],
                            'selectors' => [
                                '{{WRAPPER}} .pxl-play-video .pxl-item--btn' => 'right: {{SIZE}}{{UNIT}}; left: auto;',
                            ],
                        ),
                        array(                            
                            'name' => 'v_orientation',
                            'label' => esc_html__('Vertical Orientation', 'solarva'),
                            'type' => \Elementor\Controls_Manager::CHOOSE,
                            'control_type' => 'responsive',
                            'options' => [
                                'top' => [
                                    'label' => esc_html__('Top', 'solarva'), 
                                    'icon' => 'eicon-v-align-top'
                                ],
                                'bottom' => [
                                    'label' => esc_html__('Bottom', 'solarva'), 
                                    'icon' => 'eicon-v-align-bottom'
                                ],
                            ],
                            'selectors' => [
                                '{{WRAPPER}} .pxl-play-video .pxl-item--btn' => '{{VALUE}}: 0;',
                            ],
                        ),
                        array(
                            'name' => 'offset_top',
                            'label' => esc_html__('Top', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::SLIDER,
                            'size_units' => [ 'px','%','em','rem', 'custom' ],
                            'control_type' => 'responsive',
                            'default' => [
                                'unit' => 'px',
                                'size' => 0,
                            ],
                            'range' => [
                                'px' => [
                                    'min' => 1,
                                    'max' => 1000,
                                ],
                            ],
                            'condition' => [
                                'v_orientation' => 'top',
                            ],
                            'selectors' => [
                                '{{WRAPPER}} .pxl-play-video .pxl-item--btn' => 'top: {{SIZE}}{{UNIT}};bottom: auto;',
                            ],
                        ),
                        array(
                            'name' => 'offset_bottom',
                            'label' => esc_html__('Bottom', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::SLIDER,
                            'size_units' => [ 'px','%','em','rem', 'custom' ],
                            'control_type' => 'responsive',
                            'range' => [
                                'px' => [
                                    'min' => 1,
                                    'max' => 1000,
                                ],
                            ],
                            'default' => [
                                'unit' => 'px',
                                'size' => 0,
                            ],
                            'condition' => [
                                'v_orientation' => 'bottom',
                            ],
                            'selectors' => [
                                '{{WRAPPER}} .pxl-play-video .pxl-item--btn' => 'bottom: {{SIZE}}{{UNIT}};top: auto;',
                            ],
                        ),
                        array(
                            'name' => 'translate',
                            'label' => esc_html__('Translate', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::TEXT,
                            'placeholder' => 'Ex: -50%, -50%',
                            'control_type' => 'responsive',
                            'description' => 'Enter value with syntax: (size_x)(unit_x), (size_y)(unit_y). Default -50%, -50%',
                            'selectors' => [
                                '{{WRAPPER}} .pxl-play-video .pxl-item--btn' => 'transform: translate({{VALUE}});',
                            ],
                        ),
                    ),
                ),
            ),
        ),
    ),
    solarva_get_class_widget_path()
);