<?php
$pt_supports = ['team'];
pxl_add_custom_widget(
    array(
        'name' => 'pxl_team',
        'title' => esc_html__('Case Team', 'solarva' ),
        'icon' => 'eicon-posts-grid',
        'categories' => array('pxltheme-core'),
        'scripts' => [
            'imagesloaded',
            'isotope',
            'pxl-post-grid',
            'pxl-swiper',
            'swiper'
        ],
        'params' => array(
            'sections' => array(
                array(
                    'name'     => 'tab_layout',
                    'label'    => esc_html__( 'Layout', 'solarva' ),
                    'tab'      => 'layout',
                    'controls' => array_merge(
                        array(
                            array(
                                'name'     => 'post_type',
                                'label'    => esc_html__( 'Select Post Type', 'solarva' ),
                                'type'     => 'select',
                                'multiple' => true,
                                'options'  => solarva_get_post_type_options($pt_supports),
                                'default'  => 'team'
                            ) 
                        ),
                        solarva_get_post_grid_layout($pt_supports)
                    ),
                ),
                 
                array(
                    'name' => 'tab_source',
                    'label' => esc_html__('Source', 'solarva' ),
                    'tab' => \Elementor\Controls_Manager::TAB_SETTINGS,
                    'controls' => array_merge(
                        solarva_get_grid_ids_by_post_type($pt_supports, []),
                        array(
                            array(
                                'name' => 'layout_type',
                                'label' => esc_html__('Layout Type', 'solarva' ),
                                'type' => \Elementor\Controls_Manager::SELECT,
                                'default' => 'grid',
                                'options' => [
                                    'grid' => esc_html__('Grid', 'solarva' ),
                                    'carousel' => esc_html__('Carosuel', 'solarva' ),
                                ],
                            ),
                            array(
                                'name' => 'orderby',
                                'label' => esc_html__('Order By', 'solarva' ),
                                'type' => \Elementor\Controls_Manager::SELECT,
                                'default' => 'date',
                                'options' => [
                                    'date' => esc_html__('Date', 'solarva' ),
                                    'ID' => esc_html__('ID', 'solarva' ),
                                    'author' => esc_html__('Author', 'solarva' ),
                                    'title' => esc_html__('Title', 'solarva' ),
                                    'rand' => esc_html__('Random', 'solarva' ),
                                ],
                            ),
                            array(
                                'name' => 'order',
                                'label' => esc_html__('Sort Order', 'solarva' ),
                                'type' => \Elementor\Controls_Manager::SELECT,
                                'default' => 'desc',
                                'options' => [
                                    'desc' => esc_html__('Descending', 'solarva' ),
                                    'asc' => esc_html__('Ascending', 'solarva' ),
                                ],
                            ),
                            array(
                                'name' => 'limit',
                                'label' => esc_html__('Total items', 'solarva' ),
                                'type' => \Elementor\Controls_Manager::NUMBER,
                                'default' => '6',
                            ),

                        )
                    ),
                ),
                solarva_grid_settings(),
                solarva_carousel_settings(),                 
                array(
                    'name' => 'section_style',
                    'label' => esc_html__('General', 'solarva'),
                    'tab' => \Elementor\Controls_Manager::TAB_STYLE,
                    'controls' => array(
                        array(
                            'name' => 'bg_color',
                            'label' => esc_html__('Backgrond Color', 'solarva'),
                            'type' => \Elementor\Controls_Manager::COLOR,
                            'selectors' => [
                                '{{WRAPPER}} .pxl-team-grid .pxl-post--inner,
                                {{WRAPPER}} .pxl-team-carousel .pxl-post--inner' => 'background-color: {{VALUE}}'
                            ],
                        ),
                        array(
                            'name' => 'item_spacing_column',
                            'label' => esc_html__('Spacing Column', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::SLIDER,
                            'control_type' => 'responsive',
                            'placeholder' => 'Ex: 15',
                            'size_units' => ['px'], 
                            'range' => [
                                'px' => [
                                    'min' => 0,
                                    'max' => 1000,
                                ],
                            ],
                            'selectors' => [
                                '{{WRAPPER}} .pxl-grid .pxl-grid-inner .pxl-grid-item' => 'padding-inline: {{SIZE}}{{UNIT}};',
                                '{{WRAPPER}} .pxl-grid .pxl-grid-inner' => 'margin-inline: -{{SIZE}}{{UNIT}}',
                            ],
                        ),
                        array(
                            'name' => 'item_spacing_row',
                            'label' => esc_html__('Spacing Row', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::SLIDER,
                            'control_type' => 'responsive',
                            'placeholder' => 'Ex: 15',
                            'size_units' => ['px'], 
                            'range' => [
                                'px' => [
                                    'min' => 0,
                                    'max' => 1000,
                                ],
                            ],
                            'selectors' => [
                                '{{WRAPPER}} .pxl-grid .pxl-grid-inner .pxl-grid-item' => 'padding-block: {{SIZE}}{{UNIT}};',
                                '{{WRAPPER}} .pxl-grid .pxl-grid-inner' => 'margin-block: -{{SIZE}}{{UNIT}}',
                            ],
                        ),
                        array(
                            'name' => 'padding',
                            'label' => esc_html__( 'Padding', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::DIMENSIONS,
                            'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
                            'control_type' => 'responsive',
                            'selectors' => [
                                '{{WRAPPER}} .pxl-team-carousel .pxl-carousel-inner' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
                            ],
                            'condition' => [
                                'layout_type' => 'carousel',
                            ]
                        ),
                    ),
                ),
                array(
                    'name' => 'section_style_featured',
                    'label' => esc_html__('Featured', 'solarva'),
                    'tab' => \Elementor\Controls_Manager::TAB_STYLE,
                    'controls' => array( 
                        array(
                            'name' => 'img_size',
                            'label' => esc_html__('Image Size', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::TEXT,
                            'placeholder' => 'Ex: "thumbnail", "full" or 370x300 v.v).',
                        ),
                        array(
                            'name' => 'featured_spacing_b',
                            'label' => esc_html__('Spacing Bottom', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::SLIDER,
                            'control_type' => 'responsive',
                            'size_units' => ['px'], 
                            'range' => [
                                'px' => [
                                    'min' => 0,
                                    'max' => 1000,
                                ],
                            ],
                            'selectors' => [
                                '{{WRAPPER}} .pxl-team-grid .pxl-post--featured,
                                {{WRAPPER}} .pxl-team-carousel .pxl-post--featured' => 'margin-bottom: {{SIZE}}{{UNIT}};',
                            ],
                        ),
                        array(
                            'name' => 'featured_border_radius',
                            'label' => esc_html__( 'Border Radius', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::DIMENSIONS,
                            'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
                            'control_type' => 'responsive',
                            'selectors' => [
                                '{{WRAPPER}} .pxl-team-grid .pxl-post--featured .pxl-featured--link, 
                                {{WRAPPER}} .pxl-team-carousel .pxl-post--featured .pxl-featured--link' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
                            ],
                        ),
                    ),
                ),
                array(
                    'name' => 'section_style_title',
                    'label' => esc_html__('Title', 'solarva'),
                    'tab' => \Elementor\Controls_Manager::TAB_STYLE,
                    'controls' => array( 
                        array(
                            'name' => 'title_normal',
                            'label' => esc_html__('NORMAL', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::HEADING,
                            'separator' => 'after',
                        ),
                        array(
                            'name' => 'title_typography',
                            'label' => esc_html__('Typography', 'solarva'),
                            'type' => \Elementor\Group_Control_Typography::get_type(),
                            'control_type' => 'group', 
                            'selector' => '{{WRAPPER}} .pxl-post-grid .pxl-post--inner .pxl-post--title,
                            {{WRAPPER}} .pxl-post-carousel .pxl-post--inner .pxl-post--title',
                        ),
                        array(
                            'name' => 'title_color',
                            'label' => esc_html__('Color', 'solarva'),
                            'type' => \Elementor\Controls_Manager::COLOR,
                            'selectors' => [
                                '{{WRAPPER}} .pxl-post-grid .pxl-post--inner .pxl-post--title,
                                {{WRAPPER}} .pxl-post-carousel .pxl-post--inner .pxl-post--title' => 'color: {{VALUE}};',
                            ]
                        ),
                        array(
                            'name' => 'title_spacing_b',
                            'label' => esc_html__('Spacing Bottom', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::SLIDER,
                            'control_type' => 'responsive',
                            'size_units' => ['px'], 
                            'range' => [
                                'px' => [
                                    'min' => 0,
                                    'max' => 1000,
                                ],
                            ],
                            'selectors' => [
                                '{{WRAPPER}} .pxl-post-grid .pxl-post--inner .pxl-post--title,
                                {{WRAPPER}} .pxl-post-carousel .pxl-post--inner .pxl-post--title' => 'margin-bottom: {{SIZE}}{{UNIT}};',
                            ],
                        ),
                        array(
                            'name' => 'divider3',
                            'type' => \Elementor\Controls_Manager::DIVIDER,
                        ),
                        array(
                            'name' => 'title_hover',
                            'label' => esc_html__('HOVER','solarva'),
                            'type' => \Elementor\Controls_Manager::HEADING,
                            'separator' => 'after',
                        ),
                        array(
                            'name' => 'title_hover_style',
                            'label' => esc_html__( 'Style', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::SELECT,
                            'default' => '',
                            'options' => [
                                '' => esc_html__( 'Default', 'solarva' ),
                                'pxl-hover-underline' => esc_html__('Underline', 'solarva' ),
                            ],
                        ),
                        array(
                            'name' => 'title_hover_color',
                            'label' => esc_html__('Color', 'solarva'),
                            'type' => Elementor\Controls_Manager::COLOR,
                            'selectors' => [
                                '{{WRAPPER}} .pxl-team-grid .pxl-post--inner .pxl-post--title:hover, 
                                {{WRAPPER}} .pxl-team-carousel .pxl-post--inner .pxl-post--title:hover' => 'color: {{VALUE}};',
                            ],
                        ),
                    ),
                ),
                array(
                    'name' => 'tab_position_style',
                    'label' => esc_html__('Position', 'solarva' ),
                    'tab' => \Elementor\Controls_Manager::TAB_STYLE,
                    'controls' => array( 
                        array(
                            'name' => 'position_color',
                            'label' => esc_html__('Color', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::COLOR,
                            'selectors' => [
                                '{{WRAPPER}} .pxl-team-grid .pxl-post--position, 
                                {{WRAPPER}} .pxl-team-carousel .pxl-post--position' => 'color: {{VALUE}};',
                            ],
                        ),
                        array(
                            'name' => 'position_typography',
                            'label' => esc_html__('Typography', 'solarva' ),
                            'type' => \Elementor\Group_Control_Typography::get_type(),
                            'control_type' => 'group', 
                            'selector' => '{{WRAPPER}} .pxl-team-grid .pxl-post--position, {{WRAPPER}} .pxl-team-carousel .pxl-post--position',
                        ),
                    ),
                    
                ),
                array(
                    'name' => 'section_style_btn',
                    'label' => esc_html__('Button', 'solarva'),
                    'tab' => \Elementor\Controls_Manager::TAB_STYLE,
                    'conditions' => [
                        'relation' => 'or',
                        'terms' => [
                            [
                                'terms' => [
                                    ['name' => 'post_type', 'operator' => '==', 'value' => 'team'],
                                    ['name' => 'layout_team', 'operator' => 'in', 'value' => ['team-1']],
                                ],
                            ],
                        ],
                    ],
                    'controls' => array( 
                        array(
                            'name' => 'btn_color',
                            'label' => esc_html__('Color', 'solarva'),
                            'type' => \Elementor\Controls_Manager::COLOR,
                            'selectors' => [
                                '{{WRAPPER}} .pxl-team-grid .pxl-post--inner .pxl-post--btn .plus path' => 'fill: {{VALUE}};',
                                '{{WRAPPER}} .pxl-team-grid .pxl-post--inner .pxl-post--btn' => 'color: {{VALUE}}'
                            ],
                        ),
                        array(
                            'name' => 'btn_bg_color',
                            'label' => esc_html__('Background Color', 'solarva'),
                            'type' => \Elementor\Controls_Manager::COLOR,
                            'selectors' => [
                                '{{WRAPPER}} .pxl-team-grid .pxl-post--inner .pxl-post--btn' => 'background-color: {{VALUE}}'
                            ],
                        ),
                    ),
                ),

                array(
                    'name' => 'tab_socials',
                    'label' => esc_html__('Socials', 'solarva'),
                    'tab' => \Elementor\Controls_Manager::TAB_STYLE,
                    'controls' => array( 
                        array(
                            'name' => 'social_bg_color',
                            'label' => esc_html__('Backgrond Color', 'solarva'),
                            'type' => \Elementor\Controls_Manager::COLOR,
                            'selectors' => [
                                '{{WRAPPER}} .pxl-team-grid .pxl-item--socials,
                                {{WRAPPER}} .pxl-team-carousel .pxl-item--socials' => 'background-color: {{VALUE}}'
                            ],
                        ),
                        array(
                            'name' => 'social_color',
                            'label' => esc_html__('Color', 'solarva'),
                            'type' => \Elementor\Controls_Manager::COLOR,
                            'selectors' => [
                                '{{WRAPPER}} .pxl-team-grid .pxl-item--socials .pxl-social--link, 
                                {{WRAPPER}} .pxl-team-carousel .pxl-item--socials .pxl-social--link' => 'color: {{VALUE}}'
                            ],
                        ),
                        array(
                            'name' => 'social_color_hover',
                            'label' => esc_html__('Color Hover', 'solarva'),
                            'type' => \Elementor\Controls_Manager::COLOR,
                            'selectors' => [
                                '{{WRAPPER}} .pxl-team-grid .pxl-item--socials .pxl-social--link:hover, 
                                {{WRAPPER}} .pxl-team-carousel .pxl-item--socials .pxl-social--link:hover' => 'color: {{VALUE}}'
                            ],
                        ),
                        array(
                            'name' => 'socials_width',
                            'label' => esc_html__('Width', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::SLIDER,
                            'control_type' => 'responsive',
                            'size_units' => ['px'], 
                            'range' => [
                                'px' => [
                                    'min' => 0,
                                    'max' => 1000,
                                ],
                            ],
                            'selectors' => [
                                '{{WRAPPER}} .pxl-team-grid1 .pxl-item--socials,
                                {{WRAPPER}} .pxl-team-carousel1 .pxl-item--socials' => 'width: {{SIZE}}{{UNIT}};',
                            ],
                            'conditions' => [
                                'relation' => 'or',
                                'terms' => [
                                    [
                                        'terms' => [
                                            ['name' => 'post_type', 'operator' => '==', 'value' => 'team'],
                                            ['name' => 'layout_team', 'operator' => 'in', 'value' => ['team-1']],
                                        ],
                                    ],
                                ],
                            ],
                        ),
                        array(
                            'name' => 'socials_gap',
                            'label' => esc_html__('Gap', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::SLIDER,
                            'control_type' => 'responsive',
                            'size_units' => ['px'], 
                            'range' => [
                                'px' => [
                                    'min' => 0,
                                    'max' => 1000,
                                ],
                            ],
                            'selectors' => [
                                '{{WRAPPER}} .pxl-team-grid .pxl-item--socials,
                                {{WRAPPER}} .pxl-team-carousel .pxl-item--socials' => 'gap: {{SIZE}}{{UNIT}};',
                            ],
                        ),
                    ),
                ),
                solarva_widget_animation_settings(),
            ),
        ),
    ),
    solarva_get_class_widget_path()
);