Widget_Testimonial::_register_controls()
Register testimonial widget controls.
Description
Adds different input fields to allow the user to change and customize the widget settings.
Changelog
Version | Description |
---|---|
1.0.0 | Introduced. |
Source
includes/widgets/testimonial.php
], 'rows' => '10', 'default' => '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.', ] ); $this->add_control( 'testimonial_image', [ 'label' => __( 'Choose Image', 'elementor' ), 'type' => Controls_Manager::MEDIA, 'default' => [ 'url' => Utils::get_placeholder_image_src(), ], ] ); $this->add_group_control( Group_Control_Image_Size::get_type(), [ 'name' => 'testimonial_image', // Usage: `{name}_size` and `{name}_custom_dimension`, in this case `testimonial_image_size` and `testimonial_image_custom_dimension`. 'default' => 'full', 'separator' => 'none', ] ); $this->add_control( 'testimonial_name', [ 'label' => __( 'Name', 'elementor' ), 'type' => Controls_Manager::TEXT, 'dynamic' => [ 'active' => true, ], 'default' => 'John Doe', ] ); $this->add_control( 'testimonial_job', [ 'label' => __( 'Job', 'elementor' ), 'type' => Controls_Manager::TEXT, 'dynamic' => [ 'active' => true, ], 'default' => 'Designer', ] ); $this->add_control( 'link', [ 'label' => __( 'Link to', 'elementor' ), 'type' => Controls_Manager::URL, 'placeholder' => __( 'https://your-link.com', 'elementor' ), ] ); $this->add_control( 'testimonial_image_position', [ 'label' => __( 'Image Position', 'elementor' ), 'type' => Controls_Manager::SELECT, 'default' => 'aside', 'options' => [ 'aside' => __( 'Aside', 'elementor' ), 'top' => __( 'Top', 'elementor' ), ], 'condition' => [ 'testimonial_image[url]!' => '', ], 'separator' => 'before', ] ); $this->add_control( 'testimonial_alignment', [ 'label' => __( 'Alignment', 'elementor' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'center', 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor' ), 'icon' => 'fa fa-align-right', ], ], 'label_block' => false, ] ); $this->add_control( 'view', [ 'label' => __( 'View', 'elementor' ), 'type' => Controls_Manager::HIDDEN, 'default' => 'traditional', ] ); $this->end_controls_section(); // Content. $this->start_controls_section( 'section_style_testimonial_content', [ 'label' => __( 'Content', 'elementor' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'content_content_color', [ 'label' => __( 'Text Color', 'elementor' ), 'type' => Controls_Manager::COLOR, 'scheme' => [ 'type' => Scheme_Color::get_type(), 'value' => Scheme_Color::COLOR_3, ], 'default' => '', 'selectors' => [ '{{WRAPPER}} .elementor-testimonial-content' => 'color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'content_typography', 'scheme' => Scheme_Typography::TYPOGRAPHY_3, 'selector' => '{{WRAPPER}} .elementor-testimonial-content', ] ); $this->end_controls_section(); // Image. $this->start_controls_section( 'section_style_testimonial_image', [ 'label' => __( 'Image', 'elementor' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'testimonial_image[url]!' => '', ], ] ); $this->add_control( 'image_size', [ 'label' => __( 'Image Size', 'elementor' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px' ], 'range' => [ 'px' => [ 'min' => 20, 'max' => 200, ], ], 'selectors' => [ '{{WRAPPER}} .elementor-testimonial-wrapper .elementor-testimonial-image img' => 'width: {{SIZE}}{{UNIT}};height: {{SIZE}}{{UNIT}};', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'image_border', 'selector' => '{{WRAPPER}} .elementor-testimonial-wrapper .elementor-testimonial-image img', 'separator' => 'before', ] ); $this->add_control( 'image_border_radius', [ 'label' => __( 'Border Radius', 'elementor' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .elementor-testimonial-wrapper .elementor-testimonial-image img' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_section(); // Name. $this->start_controls_section( 'section_style_testimonial_name', [ 'label' => __( 'Name', 'elementor' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'name_text_color', [ 'label' => __( 'Text Color', 'elementor' ), 'type' => Controls_Manager::COLOR, 'scheme' => [ 'type' => Scheme_Color::get_type(), 'value' => Scheme_Color::COLOR_1, ], 'default' => '', 'selectors' => [ '{{WRAPPER}} .elementor-testimonial-name' => 'color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'name_typography', 'scheme' => Scheme_Typography::TYPOGRAPHY_1, 'selector' => '{{WRAPPER}} .elementor-testimonial-name', ] ); $this->end_controls_section(); // Job. $this->start_controls_section( 'section_style_testimonial_job', [ 'label' => __( 'Job', 'elementor' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'job_text_color', [ 'label' => __( 'Text Color', 'elementor' ), 'type' => Controls_Manager::COLOR, 'scheme' => [ 'type' => Scheme_Color::get_type(), 'value' => Scheme_Color::COLOR_2, ], 'default' => '', 'selectors' => [ '{{WRAPPER}} .elementor-testimonial-job' => 'color: {{VALUE}};', ], ]
Uses
- includes/controls/groups/typography.php: Group_Control_Typography::get_type()
- includes/controls/groups/image-size.php: Group_Control_Image_Size::get_type()
- includes/controls/groups/border.php: Group_Control_Border::get_type()
- includes/utils.php: Utils::get_placeholder_image_src()
- includes/schemes/color.php: Scheme_Color::get_type()