<?php
pxl_add_custom_widget(
    array(
        'name' => 'pxl_heading',
        'title' => esc_html__('Case Heading', 'solarva' ),
        'icon' => 'eicon-heading',
        'categories' => array('pxltheme-core'),
        'scripts'    => array(
            'gsap',
            'pxl-scroll-trigger',
            'pxl-splitText',
        ),
        'params' => array(
            'sections' => array(
                array(
                    'name' => 'section_content',
                    'label' => esc_html__('Content', 'solarva' ),
                    'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
                    'controls' => array(
                        array(
                            'name' => 'source_type',
                            'label' => esc_html__('Source Type', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::SELECT,
                            'options' => [
                                'text' => 'Text',
                                'title' => 'Page Title',
                            ],
                            'default' => 'text',
                        ),
                        array(
                            'name' => 'is_custom_text',
                            'label' => esc_html__('Custom Title', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::SWITCHER,
                            'default' => 'true',
                            'condition' => [
                                'source_type' => 'title',
                            ]
                        ),
                        array(
                            'name' => 'show_title',
                            'label' => esc_html__('Show Title', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::SWITCHER,
                            'default' => 'true',
                        ),
                        array(
                            'name' => 'title',
                            'label' => esc_html__('Title', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::TEXTAREA,
                            'label_block' => true,
                            'rows' => 3,
                            'condition' => [
                                'source_type' => ['text'],
                                'show_title!' => '',
                            ],
                            'description' => 'Highlight text with shortcode: [highlight text="Text"] and Highlight image with shortcode: [highlight_image id_image="123"]',
                        ),
                        array(
                            'name' => 'show_subtitle',
                            'label' => esc_html__('Show Subtitle', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::SWITCHER,
                            'default' => 'true',
                        ),
                        array(
                            'name' => 'subtitle',
                            'label' => esc_html__('Subtitle', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::TEXTAREA,
                            'rows' => 2,
                            'label_block' => true,
                            'condition' => [
                                'source_type' => ['text'],
                                'show_subtitle!' => '',
                            ],
                        ),
                    ),
                ),

                array(
                    'name' => 'section_style',
                    'label' => esc_html__('General', 'solarva' ),
                    'tab' => \Elementor\Controls_Manager::TAB_STYLE,
                    'controls' => array(
                        array(
                            'name' => 'justify_content',
                            'label' => esc_html__('Justify Content', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::CHOOSE,
                            'default' => '',
                            'options' => [
                                'start' =>  [
                                    'title' => esc_html__('Start', 'solarva'),
                                    'icon' => 'eicon-justify-start-h',
                                ],
                                'center' =>  [
                                    'title' => esc_html__('Center', 'solarva'),
                                    'icon' => 'eicon-justify-center-h',
                                ],
                                'end' =>  [
                                    'title' => esc_html__('End', 'solarva'),
                                    'icon' => 'eicon-justify-end-h',
                                ],
                            ],
                            'selectors' => [
                                '{{WRAPPER}} .pxl-heading .pxl-item--container' => 'justify-content: {{VALUE}}'
                            ],
                        ),
                        array(
                            'name' => 'align_items',
                            'label' => esc_html__('Align Items', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::CHOOSE,
                            'default' => '',
                            'options' => [
                                'start' =>  [
                                    'title' => esc_html__('Start', 'solarva'),
                                    'icon' => 'eicon-align-start-h',
                                ],
                                'center' =>  [
                                    'title' => esc_html__('Center', 'solarva'),
                                    'icon' => 'eicon-align-center-h',
                                ],
                                'end' =>  [
                                    'title' => esc_html__('End', 'solarva'),
                                    'icon' => 'eicon-align-end-h',
                                ],
                            ],
                            'selectors' => [
                                '{{WRAPPER}} .pxl-heading .pxl-item--inner' => 'align-items: {{VALUE}};text-align:{{VALUE}}'
                            ],
                        ),
                        array(
                            'name' => 'max_width',
                            'label' => esc_html__('Max Width', 'solarva'),
                            'type' => \Elementor\Controls_Manager::SLIDER,
                            'size_units' => ['px', '%', 'rem', 'em', 'custom'],
                            'range' => [
                                'px' => [
                                    'min' => 1,
                                    'max' => 1000,
                                ],
                            ],
                            'control_type' => 'responsive',
                            'selectors' => [
                                '{{WRAPPER}} .pxl-heading .pxl-item--inner' => 'max-width: {{SIZE}}{{UNIT}};',
                            ],
                        ),
                    ),
                ),
                // Option Style Title
                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_tag',
                            'label' => esc_html__('HTML Tag', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::SELECT,
                            'options' => [
                                'h1' => 'H1',
                                'h2' => 'H2',
                                'h3' => 'H3',
                                'h4' => 'H4',
                                'h5' => 'H5',
                                'h6' => 'H6',
                                'div' => 'div',
                                'span' => 'span',
                                'p' => 'p',
                            ],
                            'default' => 'h2',
                        ),
                        array(
                            'name' => 'title_style',
                            'label' => esc_html__('Style', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::SELECT,
                            'default' => '',
                            'options' => [
                                ''   => esc_html__('Default', 'solarva'), 
                                'h7' => esc_html__('H7', 'solarva'), 
                                'h8' => esc_html__('H8', 'solarva'), 
                                'h9' => esc_html__('H9', 'solarva'), 
                                'pxl-h-d1' => esc_html__('D1', 'solarva'), 
                                'pxl-h-underlined1' => ('Underlined H7'),
                                'pxl-h-underlined2' => ('Underlined H3'),
                                'pxl-h-case-details' => esc_html__('Heading Case Details', 'solarva'), 
                                'pxl-h-custom' => esc_html__('Custom', 'solarva'),
                            ],
                        ),
                        array(
                            'name' => 'title_color',
                            'label' => esc_html__('Color', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::COLOR,
                            'selectors' => [
                                '{{WRAPPER}} .pxl-heading .pxl-item--title' => 'color: {{VALUE}}'
                            ],
                        ),
                        array(
                            'name' => 'title_typography',
                            'label' => esc_html__('Typography', 'solarva' ),
                            'type' => \Elementor\Group_Control_Typography::get_type(),
                            'control_type' => 'group',
                            'selector' => '{{WRAPPER}} .pxl-heading .pxl-item--title',
                        ),
                        array(
                            'name' => 'title_shadow',
                            'label' => esc_html__('Shadow', 'solarva' ),
                            'type' => \Elementor\Group_Control_Text_Shadow::get_type(),
                            'control_type' => 'group',
                            'selector' => '{{WRAPPER}} .pxl-heading .pxl-item--title',
                            'separator' => 'after',
                        ),

                        array(
                            'name' => 'title_position',
                            'label' => esc_html__('Position', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::CHOOSE,
                            'default' => '',
                            'options' => [
                                'column-reverse' =>  [
                                    'title' => esc_html__('Top', 'solarva'),
                                    'icon' => 'eicon-v-align-top',
                                ],
                                '' =>  [
                                    'title' => esc_html__('Bottom', 'solarva'),
                                    'icon' => 'eicon-v-align-bottom',
                                ],
                            ],
                            'selectors' => [
                                '{{WRAPPER}} .pxl-heading .pxl-item--inner' => 'flex-direction: {{VALUE}}',
                                '{{WRAPPER}} .pxl-heading .pxl-item--inner .pxl-item-subtitle' => 'margin-bottom: 0',
                            ],
                        ),
                        array(
                            'name' => 'title_spacer_bottom',
                            'label' => esc_html__('Spacing Bottom', 'solarva'),
                            'type' => \Elementor\Controls_Manager::SLIDER,
                            'size_units' => ['px', '%', 'rem', 'em', 'custom'],
                            'control_type' => 'responsive',
                            'selectors' => [
                                '{{WRAPPER}} .pxl-heading .pxl-item--title' => 'margin-bottom: {{SIZE}}{{UNIT}};',
                            ],
                            'condition' => [
                                'title_position' => 'column-reverse',
                            ],
                        ),
                        array(
                            'name' => 'title_padding',
                            'label' => esc_html__( 'Padding', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::DIMENSIONS,
                            'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
                            'control_type' => 'responsive',
                            'selectors' => [
                                '{{WRAPPER}} .pxl-heading .pxl-item--title' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
                            ],
                        ),


                        array(
                            'name' => 'divider1',
                            'type' => \Elementor\Controls_Manager::DIVIDER,
                        ),
                        array(
                            'name' => 'title_highlight',
                            'label' => esc_html__('HIGHLIGHT', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::HEADING,
                            'separator' => 'after' ,
                        ),
                        array(
                            'name' => 'title_highlight_color',
                            'label' => esc_html__('Color', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::COLOR,
                            'selectors' => [
                                '{{WRAPPER}} .pxl-heading .pxl-item--title .pxl-title--highlight' => 'color: {{VALUE}}'
                            ],
                        ),
                        array(
                            'name' => 'title_highlight_typography',
                            'label' => esc_html__('Typography', 'solarva' ),
                            'type' => \Elementor\Group_Control_Typography::get_type(),
                            'control_type' => 'group',
                            'selector' => '{{WRAPPER}} .pxl-heading .pxl-item--title .pxl-title--highlight',
                        ),
                        array(
                            'name' => 'divider2',
                            'type' => \Elementor\Controls_Manager::DIVIDER,
                        ),
                        array(
                            'name' => 'title_animation',
                            'label' => esc_html__('ANIMATION', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::HEADING,
                            'separator' => 'after' ,
                        ),
                        array(
                            'name' => 'title_animate',
                            'label' => esc_html__('Animate', 'solarva'),
                            'type' => \Elementor\Controls_Manager::SELECT,
                            'options' => solarva_widget_animate(),
                            'default' => '',
                        ),
                        array(
                            'name' => 'title_animate_delay',
                            'label' => esc_html__('Delay', 'solarva'),
                            'type' => \Elementor\Controls_Manager::TEXT,
                            'placeholder' => 'Ex: 500',
                        ),

                    ),
                ),

                array(
                    'name' => 'section_style_subtitle',
                    'label' => esc_html__('Subtitle', 'solarva' ),
                    'tab' => \Elementor\Controls_Manager::TAB_STYLE,
                    'condition' => [
                        'show_subtitle!' => '', 
                    ],
                    'controls' => array(
                        array(
                            'name' => 'subtitle_normal',
                            'label' => esc_html__('NORMAL', 'solarva'),
                            'type' => Elementor\Controls_Manager::HEADING,
                            'separator' => 'after',
                        ),
                        array(
                            'name' => 'subtitle_style',
                            'label' => esc_html__('Style', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::SELECT,
                            'default' => 'pxl-subtitle-default',
                            'options' => [
                                'pxl-subtitle-default' => esc_html__('Subheading Default', 'solarva'),
                                'pxl-subh-box-color' => esc_html__('Subheading Box Color', 'solarva'),
                                'pxl-subh-box-gradient' => esc_html__('Subheading Box Gradient', 'solarva'),
                                'pxl-subh-box-border' => esc_html__('Subheading Box Border', 'solarva'),
                                'subheading-custom' => esc_html__('Custom', 'solarva'),
                            ],
                        ),
                        array(
                            'name' => 'subtext_style',
                            'label' => esc_html__('Text Type', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::SELECT,
                            'default' => '', 
                            'options' => [
                                '' => esc_html__('None', 'solarva'), 
                                'pxl-text1' => esc_html__('Text 1', 'solarva'), 
                                'pxl-text2' => esc_html__('Text 2', 'solarva'), 
                                'pxl-text3' => esc_html__('Text 3', 'solarva'), 
                                'pxl-text4' => esc_html__('Text 4', 'solarva'), 
                                'pxl-text5' => esc_html__('Text 5', 'solarva'), 
                                'pxl-text6' => esc_html__('Text 6', 'solarva'), 
                            ],
                        ),
                        array(
                            'name' => 'subtitle_color_from',
                            'label' => esc_html__('Color From', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::COLOR,
                            'selectors' => [
                                '{{WRAPPER}} .pxl-heading .pxl-item--subtitle' => '--gradient-color-from: {{VALUE}}'
                            ],
                            'condition' => [
                                'subtitle_style' => 'pxl-subh-box-gradient',
                            ],
                        ),
                        array(
                            'name' => 'subtitle_color_to',
                            'label' => esc_html__('Color From', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::COLOR,
                            'selectors' => [
                                '{{WRAPPER}} .pxl-heading .pxl-item--subtitle' => '--gradient-color-to: {{VALUE}}'
                            ],
                            'condition' => [
                                'subtitle_style' => 'pxl-subh-box-gradient',
                            ],
                        ),
                        array(
                            'name' => 'subtitle_color',
                            'label' => esc_html__('Color', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::COLOR,
                            'selectors' => [
                                '{{WRAPPER}} .pxl-heading .pxl-item--subtitle' => 'color: {{VALUE}}'
                            ],
                        ),
                        array(
                            'name' => 'subtitle_bg_color',
                            'label' => esc_html__('Background Color', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::COLOR,
                            'selectors' => [
                                '{{WRAPPER}} .pxl-heading .pxl-item--subtitle .pxl-item--subtext' => 'background-color: {{VALUE}}'
                            ],
                            'condition' => [
                                'subtitle_style!' => 'pxl-subh-box-gradient',
                            ],
                        ),
                        array(
                            'name' => 'subtitle_typography',
                            'label' => esc_html__('Typography', 'solarva' ),
                            'type' => \Elementor\Group_Control_Typography::get_type(),
                            'control_type' => 'group',
                            'selector' => '{{WRAPPER}} .pxl-heading .pxl-item--subtitle',
                        ),
                        array(
                            'name' => 'subtitle_spacer_bottom',
                            'label' => esc_html__('Space Bottom', 'solarva'),
                            'type' => \Elementor\Controls_Manager::SLIDER,
                            'size_units' => ['px', '%', 'rem', 'em', 'custom'],
                            'control_type' => 'responsive',
                            'selectors' => [
                                '{{WRAPPER}} .pxl-heading .pxl-item--subtitle' => 'margin-bottom: {{SIZE}}{{UNIT}};',
                            ],
                        ),
                        array(
                            'name' => 'subtitle_spacer_left',
                            'label' => esc_html__('Spacing Left', 'solarva'),
                            'type' => \Elementor\Controls_Manager::SLIDER,
                            'size_units' => ['px', '%', 'rem', 'em', 'custom'],
                            'control_type' => 'responsive',
                            'selectors' => [
                                '{{WRAPPER}} .pxl-heading .pxl-item--subtitle .pxl-item--subtext' => 'margin-left: {{SIZE}}{{UNIT}};',
                            ],
                            'condition' => [
                                'subtitle_style' => 'pxl-subtitle-default',
                            ],
                        ),
                        array(
                            'name' => 'subtitle_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-heading .pxl-item--subtitle .pxl-item--subtext' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
                            ],
                        ),
                        array(
                            'name' => 'subtitle_padding',
                            'label' => esc_html__( 'Padding', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::DIMENSIONS,
                            'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
                            'control_type' => 'responsive',
                            'selectors' => [
                                '{{WRAPPER}} .pxl-heading .pxl-item--subtitle .pxl-item--subtext' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
                            ],
                        ),
                        array(
                            'name' => 'divider3',
                            'type' => Elementor\Controls_Manager::DIVIDER,
                            'condition' => [
                            'subtitle_style' => 'pxl-subtitle-default',
                            ],
                        ),
                        array(
                            'name' => 'subtitle_marker',
                            'label' => esc_html__('MARKER', 'solarva'),
                            'type' => Elementor\Controls_Manager::HEADING,
                            'separator' => 'after',
                            'condition' => [
                                'subtitle_style' => 'pxl-subtitle-default',
                            ],
                        ),
                        array(
                            'name' => 'subtitle_marker_color',
                            'label' => esc_html__('Color', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::COLOR,
                            'selectors' => [
                                '{{WRAPPER}} .pxl-heading .pxl-item--subtitle svg path, {{WRAPPER}} .pxl-heading .pxl-item--subtitle svg rect' => 'fill: {{VALUE}}'
                            ],
                            'condition' => [
                                'subtitle_style' => 'pxl-subtitle-default',
                            ],
                        ),
                        array(
                            'name' => 'subtitle_marker_effect',
                            'label' => esc_html__('Effect', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::SELECT,
                            'options' => [
                                '' => esc_html__('None', 'solarva'),
                                'spin' => esc_html__('Spin', 'solarva'),
                                'slide' => esc_html__('Slide', 'solarva'),
                            ],
                            'default' => '',
                            'condition' => [
                                'subtitle_style' => 'pxl-subtitle-default',
                            ],
                        ),

                        array(
                            'name' => 'divider4',
                            'type' => \Elementor\Controls_Manager::DIVIDER,
                        ),
                        array(
                            'name' => 'subtitle_animation',
                            'label' => esc_html__('ANIMATION', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::HEADING,
                            'separator' => 'after' ,
                        ),
                        array(
                            'name' => 'subtitle_animate',
                            'label' => esc_html__('Animate', 'solarva'),
                            'type' => \Elementor\Controls_Manager::SELECT,
                            'options' => solarva_widget_animate(),
                            'default' => '',
                        ),
                        array(
                            'name' => 'subtitle_animate_delay',
                            'label' => esc_html__('Delay', 'solarva'),
                            'type' => \Elementor\Controls_Manager::TEXT,
                            'placeholder' => 'Ex: 500',
                        ),
                    ),
                ),
            ),
        ),
    ),
    solarva_get_class_widget_path()
);