<?php
// Register Text Editor
use \Elementor\Controls_Manager;
use \Elementor\Group_Control_Typography;
pxl_add_custom_widget(
    array(
        'name' => 'pxl_text_editor',
        'title' => esc_html__('Case Text Editor', 'solarva'),
        'icon' => 'eicon-text',
        'categories' => array('pxltheme-core'),
        'params' => array(
            'sections' => array(
                array(
                    'name' => 'section_content',
                    'label' => esc_html__('Editor', 'solarva' ),
                    'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
                    'controls' => array(
                        array(
                            'name' => 'text',
                            'label' => '',
                            'type' => Controls_Manager::WYSIWYG,
                            'default' => esc_html__( 'Click edit button to change this text. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.', 'solarva' ),
                            'description' => 'Create Highlight text width shortcode: [pxl_highlight text="Text Demo"]',
                        ),
                    ),
                ),
                array(
                    'name' => 'section_style',
                    'label' => esc_html__( 'Text', 'solarva' ),
                    'tab' => Controls_Manager::TAB_STYLE,
                    'controls' => array(
                        array(
                            'name' => 'text_style',
                            'label' => esc_html__('Style', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::SELECT,
                            'default' => 'pxl-text2', 
                            'options' => [
                                'pxl-custom' => esc_html__('Custom', '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'), 
                                'pxl-paragraph3' => esc_html__('Paragraph 3', 'solarva'), 
                                'h1' => esc_html__('Heading 1', 'solarva'), 
                                'h2' => esc_html__('Heading 2', 'solarva'), 
                                'h3' => esc_html__('Heading 3', 'solarva'), 
                                'h4' => esc_html__('Heading 4', 'solarva'), 
                                'h5' => esc_html__('Heading 5', 'solarva'), 
                                'h6' => esc_html__('Heading 6', 'solarva'), 
                                'h7' => esc_html__('Heading 7', 'solarva'), 
                                'h8' => esc_html__('Heading 8', 'solarva'), 
                                'h9' => esc_html__('Heading 9', 'solarva'), 
                            ],
                        ),
                        array(
                            'name' => 'align',
                              'label' => esc_html__( 'Alignment', 'solarva' ),
                              'type' => \Elementor\Controls_Manager::CHOOSE,
                              'control_type' => 'responsive',
                              'options' => [
                                  'left' => [
                                      'title' => esc_html__( 'Left', 'solarva' ),
                                      'icon' => 'eicon-text-align-left',
                                  ],
                                  'center' => [
                                      'title' => esc_html__( 'Center', 'solarva' ),
                                      'icon' => 'eicon-text-align-center',
                                  ],
                                  'right' => [
                                      'title' => esc_html__( 'Right', 'solarva' ),
                                      'icon' => 'eicon-text-align-right',
                                  ],
                                  'justify' => [
                                      'title' => esc_html__( 'Justified', 'solarva' ),
                                      'icon' => 'eicon-text-align-justify',
                                  ],
                              ],
                              'selectors' => [
                                  '{{WRAPPER}} .pxl-text-editor' => 'text-align: {{VALUE}};',
                              ],
                          ),
                          array(
                            'name' => 'max_width',
                            'label' => esc_html__('Max Width', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::SLIDER,
                            'control_type' => 'responsive',
                            'size_units' => [ 'px', '%', 'em', 'rem', 'cusstom' ],
                            'range' => [
                                'px' => [
                                    'min' => 0,
                                    'max' => 1000,
                                ],
                            ],
                            'selectors' => [
                                '{{WRAPPER}} .pxl-text-editor .pxl-item--inner' => 'max-width: {{SIZE}}{{UNIT}};',
                            ],
                          ),
                        array(
                            'name' => 'text_color',
                            'label' => esc_html__( 'Color', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::COLOR,
                            'default' => '',
                            'selectors' => [
                                '{{WRAPPER}} .pxl-text-editor .pxl-item--inner' => 'color: {{VALUE}};',
                            ],
                        ),
                        array(
                            'name' => 'text_typography',
                            'type' => \Elementor\Group_Control_Typography::get_type(),
                            'label' => esc_html__( 'Typography', 'solarva' ),
                            'control_type' => 'group',
                            'selector' => '{{WRAPPER}} .pxl-text-editor .pxl-item--inner',
                        ),                        
                    ),
                ),
                array(
                    'name' => 'section_style_link',
                    'label' => esc_html__('Link', 'solarva' ),
                    'tab' => \Elementor\Controls_Manager::TAB_STYLE,
                    'controls' => array(
                        array(
                            'name' => 'link_color',
                            'label' => esc_html__('Color', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::COLOR,
                            'selectors' => [
                                '{{WRAPPER}} .pxl-text-editor .pxl-item--inner a' => 'color: {{VALUE}};',
                            ],
                        ),
                        array(
                            'name' => 'link_typography',
                            'label' => esc_html__('Typography', 'solarva' ),
                            'type' => \Elementor\Group_Control_Typography::get_type(),
                            'control_type' => 'group',
                            'selector' => '{{WRAPPER}} .pxl-text-editor .pxl-item--inner a',
                        ),
                        array(
                            'name' => 'link_color_hover',
                            'label' => esc_html__('Color Hover', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::COLOR,
                            'selectors' => [
                                '{{WRAPPER}} .pxl-text-editor .pxl-item--inner a:hover' => 'color: {{VALUE}};',
                            ],
                        ),
                    ),
                ),
                array(
                    'name' => 'section_style_highlight',
                    'label' => esc_html__('Highlight', 'solarva' ),
                    'tab' => \Elementor\Controls_Manager::TAB_STYLE,
                    'controls' => array(
                        array(
                            'name' => 'highlight_color',
                            'label' => esc_html__('Color', 'solarva' ),
                            'type' => \Elementor\Controls_Manager::COLOR,
                            'selector' => [
                                '{{WRAPPER}} .pxl-text-editor .pxl-text--highlight' => 'color: {{VALUE}};',
                            ],
                        ),
                        array(
                            'name' => 'highlight_typography',
                            'label' => esc_html__('Typography', 'solarva' ),
                            'type' => \Elementor\Group_Control_Typography::get_type(),
                            'control_type' => 'group',
                            'selector' => '{{WRAPPER}} .pxl-text-editor .pxl-text--highlight',
                        ),
                    ),
                ),
                solarva_widget_animation_settings(),
            ),
        ),
    ),
    solarva_get_class_widget_path()
);