<?php

pxl_add_custom_widget(
    array(
        'name' => 'pxl_related_post',
        'title' => esc_html__('Case Related Post', 'solarva' ),
        'icon' => 'eicon-posts-ticker',
        'categories' => array('pxltheme-core'),
        'params' => array(
            'sections' => array(
                array(
                    'name' => 'section_source',
                    'label' => esc_html__('Source', 'solarva' ),
                    'tab' => \Elementor\Controls_Manager::TAB_SETTINGS,
                    'controls' => array(
                        array(
                            'name' => 'suggested_type',
                            'label' => esc_html__('Suggested Type', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::SELECT,
                            'default' => 'recent',
                            'options' => [
                                'related' => esc_html__('Related Posts', 'solarva' ),
                                'recent' => esc_html__('Recent Posts', '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' => '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' => 'limit',
                            'label' => esc_html__('Limit', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::NUMBER,
                            'default' => 6,
                        ),
                    ),
                ),
                array(
                    'name' => 'section_style',
                    'label' => esc_html__('General', 'solarva' ),
                    'tab' => \Elementor\Controls_Manager::TAB_STYLE,
                    'controls' => array(
                        array(
                            'name' => 'normal',
                            'label' => esc_html__('NORMAL', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::HEADING,
                            'separator' => 'after',
                        ),
                        array(
                            'name' => 'sticky',
                            'label' => esc_html__( 'Sticky', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::SELECT,
                            'control_type' => 'responsive',
                            'default' => 'relative',
                            'options' => [
                                'sticky' => esc_html__('True', 'solarva'),
                                'relative' => esc_html__('False', 'solarva')
                            ],
                            'selectors' => [
                                '{{WRAPPER}} .elementor-widget-container' => 'position: {{VALUE}};',
                            ],
                        ),
                        array(
                            'name' => 'sticky_offset_top',
                            'label' => esc_html__('Offset Top', 'solarva'),
                            'type' => \Elementor\Controls_Manager::SLIDER,
                            'size_units' => ['px', '%', 'rem', 'em', 'custom'],
                            'control_type' => 'responsive',
                            'range' => [
                                'px' => [
                                    'min' => 0,
                                    'max' => 1000,
                                ],
                            ],
                            'default' => [
                                'unit' => 'px',
                                'size' => 0,
                            ],
                            'condition' => [
                                'sticky' => 'sticky'
                            ],
                            'selectors' => [
                                '{{WRAPPER}} .elementor-widget-container' => 'top: {{SIZE}}{{UNIT}};left: 0',
                            ],
                        ),
                        array(
                            'name' => 'bg_color',
                            'label' => esc_html__('Background Color', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::COLOR,
                            'selectors' => [
                                '{{WRAPPER}} .pxl-related-post .pxl-item--link' => 'background-color: {{VALUE}};',
                            ],
                        ),
                        array(
                            'name' => 'color',
                            'label' => esc_html__('Color', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::COLOR,
                            'selectors' => [
                                '{{WRAPPER}} .pxl-related-post .pxl-item--link' => 'color: {{VALUE}};',
                            ],
                        ),
                        array(
                            'name' => 'typography',
                            'label' => esc_html__('Typography', 'solarva' ),
                            'type' => \Elementor\Group_Control_Typography::get_type(),
                            'control_type' => 'group',
                            'selector' => '{{WRAPPER}} .pxl-related-post .pxl-item--link',
                        ),
                        array(
                            'name'         => 'box_shadow',
                            'label' => esc_html__( 'Box Shadow', 'solarva' ),
                            'type'         => \Elementor\Group_Control_Box_Shadow::get_type(),
                            'control_type' => 'group',
                            'selector'     => '{{WRAPPER}} .pxl-related-post .pxl-item--link',
                            'separator' => 'after',
                        ),
                        array(
                            'name' => 'height',
                            'label' => esc_html__('Height', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::SLIDER,
                            'control_type' => 'responsive',
                            'size_units' => [ 'px' ],
                            'range' => [
                                'px' => [
                                    'min' => 0,
                                    'max' => 300,
                                ],
                            ],
                            'selectors' => [
                                '{{WRAPPER}} .pxl-related-post .pxl-item--link' => 'height: {{SIZE}}{{UNIT}};',
                            ],
                        ),
                        array(
                            'name' => 'item_spacing',
                            'label' => esc_html__('Item Spacing', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::SLIDER,
                            'control_type' => 'responsive',
                            'size_units' => [ 'px' ],
                            'range' => [
                                'px' => [
                                    'min' => 0,
                                    'max' => 300,
                                ],
                            ],
                            'selectors' => [
                                '{{WRAPPER}} .pxl-related-post .pxl-item--single + .pxl-item--single' => 'margin-top: {{SIZE}}{{UNIT}};',
                            ],
                        ),
                        array(
                            'name' => 'gap',
                            'label' => esc_html__('Gap', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::SLIDER,
                            'control_type' => 'responsive',
                            'size_units' => [ 'px' ],
                            'range' => [
                                'px' => [
                                    'min' => 0,
                                    'max' => 300,
                                ],
                            ],
                            'selectors' => [
                                '{{WRAPPER}} .pxl-related-post .pxl-item--link .pxl-item--group' => 'gap: {{SIZE}}{{UNIT}};',
                            ],
                        ),
                        array(
                            'name'         => 'border',
                            'label' => esc_html__( 'Border', 'solarva' ),
                            'type'         => \Elementor\Group_Control_Border::get_type(),
                            'control_type' => 'group',
                            'selector'     => '{{WRAPPER}} .pxl-related-post .pxl-item--link',
                            'separator' => 'before',
                        ),
                        array(
                            'name' => '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-related-post .pxl-item--link' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{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-related-post .pxl-item--link' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
                            ],
                        ),

                        array(
                            'name' => 'divider1',
                            'type' => \Elementor\Controls_Manager::DIVIDER,
                        ),
                        array(
                            'name' => 'hover',
                            'label' => esc_html__('HOVER/ACTIVE', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::HEADING,
                            'separator' => 'after',
                        ),
                        array(
                            'name' => 'bg_hover_color',
                            'label' => esc_html__('Background Color', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::COLOR,
                            'selectors' => [
                                '{{WRAPPER}} .pxl-related-post .pxl-item--link:hover,
                                {{WRAPPER}} .pxl-related-post .pxl-item--link.active' => 'background-color: {{VALUE}};',
                            ],
                        ),
                        array(
                            'name' => 'color_hover',
                            'label' => esc_html__('Color', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::COLOR,
                            'selectors' => [
                                '{{WRAPPER}} .pxl-related-post .pxl-item--link:hover,
                                {{WRAPPER}} .pxl-related-post .pxl-item--link.active' => 'color: {{VALUE}};',
                            ],
                        ),
                        array(
                            'name'         => 'box_shadow_hover',
                            'label' => esc_html__( 'Box Shadow', 'solarva' ),
                            'type'         => \Elementor\Group_Control_Box_Shadow::get_type(),
                            'control_type' => 'group',
                            'selector'     => '{{WRAPPER}} .pxl-related-post .pxl-item--link:hover,
                            {{WRAPPER}} .pxl-related-post .pxl-item--link.active',
                        ),
                        array(
                            'name'         => 'border_hover',
                            'label' => esc_html__( 'Border', 'solarva' ),
                            'type'         => \Elementor\Group_Control_Border::get_type(),
                            'control_type' => 'group',
                            'selector'     => '{{WRAPPER}} .pxl-related-post .pxl-item--link:hover,
                            {{WRAPPER}} .pxl-related-post .pxl-item--link.active',
                            'separator' => 'before',
                        ),
                        array(
                            'name' => 'border_radius_hover',
                            'label' => esc_html__( 'Border Radius', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::DIMENSIONS,
                            'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
                            'control_type' => 'responsive',
                            'selectors' => [
                                '{{WRAPPER}} .pxl-related-post .pxl-item--link:hover,
                                {{WRAPPER}} .pxl-related-post .pxl-item--link.active' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
                            ],
                        ),
                    ),
                ),

                array(
                    'name' => 'section_style_icon',
                    'label' => esc_html__('Icon', 'solarva' ),
                    'tab' => \Elementor\Controls_Manager::TAB_STYLE,
                    'controls' => array(   
                        array(
                            'name' => 'icon_normal_options',
                            'label' => esc_html__( 'NORMAL', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::HEADING,
                            'separator' => 'after',
                        ),    
                        array(
                            'name' => 'icon_color',
                            'label' => esc_html__( 'Color', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::COLOR,
                            'selectors' => [
                                '{{WRAPPER}} .pxl-related-post .pxl-item--link .pxl-item--icon' => 'color: {{VALUE}}',
                                '{{WRAPPER}} .pxl-related-post .pxl-item--link .pxl-item--icon svg path' => 'fill: {{VALUE}}',
                            ],
                        ),
                        array(
                            'name' => 'icon_bg_color',
                            'label' => esc_html__( 'Background Color', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::COLOR,
                            'selectors' => [
                                '{{WRAPPER}} .pxl-related-post .pxl-item--link .pxl-item--icon' => 'background-color: {{VALUE}}',
                            ],
                        ),
                        array(
                            'name' => 'icon_box_border',
                            'label' => esc_html__('Border', 'solarva'),
                            'type' => \Elementor\Group_Control_Border::get_type(),
                            'control_type' => 'group',
                            'selector' => '{{WRAPPER}} .pxl-related-post .pxl-item--link .pxl-item--icon',
                        ),
                        array(
                            'name' => 'icon_size',
                            'label' => esc_html__('Font Size', 'solarva'),
                            'type' => \Elementor\Controls_Manager::SLIDER,
                            'size_units' => ['px', '%', 'rem', 'em', 'custom'],
                            'control_type' => 'responsive',
                            'range' => [
                                'px' => [
                                    'min' => 0,
                                    'max' => 1000,
                                ],
                            ],
                            'selectors' => [
                                '{{WRAPPER}} .pxl-related-post .pxl-item--link .pxl-item--icon' => 'font-size: {{SIZE}}{{UNIT}};',
                            ],
                        ),
                        array(
                            'name' => 'icon_box_size',
                            'label' => esc_html__('Box Size', 'solarva'),
                            'type' => \Elementor\Controls_Manager::SLIDER,
                            'size_units' => ['px', '%', 'rem', 'em', 'custom'],
                            'control_type' => 'responsive',
                            'range' => [
                                'px' => [
                                    'min' => 0,
                                    'max' => 1000,
                                ],
                            ],
                            'selectors' => [
                                '{{WRAPPER}} .pxl-related-post .pxl-item--link .pxl-item--icon' => '--size: {{SIZE}}{{UNIT}};',
                            ],
                        ),
                        array(
                            'name' => 'icon_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-related-post .pxl-item--link .pxl-item--icon' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
                            ],
                        ),
                        array(
                            'name' => 'divider2',
                            'type' => \Elementor\Controls_Manager::DIVIDER,
                        ),
                        array(
                            'name' => 'svg_options',
                            'label' => esc_html__( 'SVG', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::HEADING,
                            'separator' => 'after',
                        ),
                        array(
                            'name' => 'svg_width',
                            'label' => esc_html__('Width', 'solarva'),
                            'type' => \Elementor\Controls_Manager::SLIDER,
                            'size_units' => ['px', '%', 'rem', 'em', 'custom'],
                            'control_type' => 'responsive',
                            'range' => [
                                'px' => [
                                    'min' => 0,
                                    'max' => 1000,
                                ],
                            ],
                            'selectors' => [
                                '{{WRAPPER}} .pxl-related-post .pxl-item--link .pxl-item--icon svg' => 'width: {{SIZE}}{{UNIT}};',
                            ],
                        ),
                        array(
                            'name' => 'svg_height',
                            'label' => esc_html__('Height', 'solarva'),
                            'type' => \Elementor\Controls_Manager::SLIDER,
                            'size_units' => ['px', '%', 'rem', 'em', 'custom'],
                            'control_type' => 'responsive',
                            'range' => [
                                'px' => [
                                    'min' => 0,
                                    'max' => 1000,
                                ],
                            ],
                            'selectors' => [
                                '{{WRAPPER}} .pxl-related-post .pxl-item--link .pxl-item--icon svg' => 'height: {{SIZE}}{{UNIT}};',
                            ],
                        ),
                        array(
                            'name' => 'divider4',
                            'type' => \Elementor\Controls_Manager::DIVIDER,
                        ),
                        array(
                            'name' => 'icon_hover',
                            'label' => esc_html__( 'HOVER', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::HEADING,
                            'separator' => 'after',
                        ),
                        array(
                            'name' => 'icon_hover_color',
                            'label' => esc_html__( 'Color', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::COLOR,
                            'selectors' => [
                                '{{WRAPPER}} .pxl-related-post .pxl-item--link:hover,
                                {{WRAPPER}} .pxl-related-post .pxl-item--link.active .pxl-item--icon' => 'color: {{VALUE}}',
                                '{{WRAPPER}} .pxl-related-post .pxl-item--link:hover,
                                {{WRAPPER}} .pxl-related-post .pxl-item--link.active .pxl-item--icon svg path' => 'fill: {{VALUE}}',
                            ],
                        ),
                        array(
                            'name' => 'icon_hover_bg_color',
                            'label' => esc_html__( 'Background Color', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::COLOR,
                            'selectors' => [
                                '{{WRAPPER}} .pxl-related-post .pxl-item--link:hover,
                                {{WRAPPER}} .pxl-related-post .pxl-item--link.active .pxl-item--icon' => 'background-color: {{VALUE}}',
                            ],
                        ),
                        array(
                            'name' => 'icon_hover_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-related-post .pxl-item--link:hover,
                                {{WRAPPER}} .pxl-related-post .pxl-item--link.active .pxl-item--icon' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
                            ],
                        ),
                    ),
                ),

                array(
                    'name' => 'section_style_arrow',
                    'label' => esc_html__('Arrow', 'solarva' ),
                    'tab' => \Elementor\Controls_Manager::TAB_STYLE,
                    'controls' => array(    
                        array(
                            'name' => 'arrow_color',
                            'label' => esc_html__( 'Color', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::COLOR,
                            'selectors' => [
                                '{{WRAPPER}} .pxl-related-post .pxl-item--arrow' => 'color: {{VALUE}}',
                                '{{WRAPPER}} .pxl-related-post .pxl-item--arrow svg path' => 'fill: {{VALUE}}',
                            ],
                        ),
                        array(
                            'name' => 'arrow_size',
                            'label' => esc_html__('Font Size', 'solarva'),
                            'type' => \Elementor\Controls_Manager::SLIDER,
                            'size_units' => ['px', '%', 'rem', 'em', 'custom'],
                            'control_type' => 'responsive',
                            'range' => [
                                'px' => [
                                    'min' => 0,
                                    'max' => 1000,
                                ],
                            ],
                            'selectors' => [
                                '{{WRAPPER}} .pxl-related-post .pxl-item--arrow' => 'width: {{SIZE}}{{UNIT}};height: {{SIZE}}{{UNIT}};',
                            ],
                        ),
                        array(
                            'name' => 'arrow_hover_color',
                            'label' => esc_html__( 'Color Hover/Active', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::COLOR,
                            'selectors' => [
                                '{{WRAPPER}} .pxl-related-post .pxl-item--link:hover,
                                {{WRAPPER}} .pxl-related-post .pxl-item--link.active .pxl-item--arrow' => 'color: {{VALUE}}',
                                '{{WRAPPER}} .pxl-related-post .pxl-item--link:hover,
                                {{WRAPPER}} .pxl-related-post .pxl-item--link.active .pxl-item--arrow svg path' => 'fill: {{VALUE}}',
                            ],
                        ),
                    ),
                ),
            ),
        ),
    ),
    solarva_get_class_widget_path()
);