Plugin Directory

source: borderless/trunk/modules/elementor/widgets/testimonial.php

Last change on this file was 3085856, checked in by visualmodo, 11 months ago

1.5.4 - May 13 2024

  • Fixed - General Vulnerabilities.
  • Dev - Tested up to WordPress 6.5.3.
  • Property svn:eol-style set to native
File size: 23.9 KB
Line 
1<?php
2
3namespace Borderless\Widgets;
4
5if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
6
7use Elementor\Widget_Base;
8use Elementor\Controls_Manager;
9use Elementor\Group_Control_Image_Size;
10use \Elementor\Group_Control_Border;
11use \Elementor\Group_Control_Typography;
12use \Elementor\Group_Control_Background;
13use \Elementor\Group_Control_Css_Filter;
14use \Elementor\Group_Control_Box_Shadow;
15use \Elementor\Icons_Manager;
16use Elementor\Repeater;
17use Elementor\Utils;
18
19class Testimonial extends Widget_Base {
20       
21        public function get_name() {
22                return 'borderless-elementor-testimonial';
23        }
24       
25        public function get_title() {
26                return esc_html__( 'Testimonial', 'borderless');
27        }
28       
29        public function get_icon() {
30                return 'borderless-icon-testimonial';
31        }
32       
33        public function get_categories() {
34                return [ 'borderless' ];
35        }
36
37        public function get_keywords()
38        {
39                return [
40                        'testimonial',
41                        'testimony',
42                        'review',
43                        'endorsement',
44                        'recommendation',
45                        'reference',
46                        'appreciation',
47                        'feedback',
48                        'star rating',
49                        'social proof',
50                        'borderless',
51                        'borderless testimonial',
52                        'borderless testimonials',
53                ];
54    }
55
56        public function get_custom_help_url()
57        {
58        return 'https://wpborderless.com/';
59    }
60
61        public function get_style_depends() {
62                return 
63                        [ 
64                                'font-awesome-5',
65                                'borderless-elementor-style'
66                        ];
67        }
68       
69        protected function _register_controls() {
70
71
72                /*-----------------------------------------------------------------------------------*/
73                /*  *.  Avatar
74                /*-----------------------------------------------------------------------------------*/
75
76                $this->start_controls_section(
77                        'borderless_section_testimonial_picture',
78                        [
79                                'label' => esc_html__( 'Picture', 'borderless' ),
80                                'tab' => Controls_Manager::TAB_CONTENT,
81                        ]
82                );
83
84                $this->add_control(
85                        'borderless_testimonial_picture',
86                        [
87                                'label' => __( 'Upload Picture', 'borderless' ),
88                                'type' => Controls_Manager::MEDIA,
89                                'default' => [
90                                        'url' => Utils::get_placeholder_image_src(),
91                                ],
92                        ]
93                );
94
95                $this->add_group_control(
96                        Group_Control_Image_Size::get_type(),
97                        [
98                                'name' => 'borderless_testimonial_picture',
99                                'default' => 'large',
100                                'separator' => 'none',
101                        ]
102                );
103
104                $this->add_responsive_control(
105                        'borderless_testimonial_picture_style',
106                        [
107                                'label' => __( 'Object Fit', 'borderless' ),
108                                'type' => Controls_Manager::SELECT,
109                                'condition' => [
110                                        'height[size]!' => '',
111                                ],
112                                'options' => [
113                                        '' => __( 'Default', 'borderless' ),
114                                        'fill' => __( 'Fill', 'borderless' ),
115                                        'cover' => __( 'Cover', 'borderless' ),
116                                        'contain' => __( 'Contain', 'borderless' ),
117                                ],
118                                'default' => '',
119                                'selectors' => [
120                                        '{{WRAPPER}} .borderless-elementor-testimonial-picture figure img' => 'object-fit: {{VALUE}};',
121                                ],
122                        ]
123                );
124
125                $this->end_controls_section();
126
127
128                /*-----------------------------------------------------------------------------------*/
129                /*  *.  Content
130                /*-----------------------------------------------------------------------------------*/
131
132                $this->start_controls_section(
133                        'borderless_section_testimonial_content',
134                        [
135                                'label' => esc_html__( 'Content', 'borderless')
136                        ]
137                );
138
139                $this->add_control(
140                        'borderless_testimonial_name',
141                        [
142                                'label' => esc_html__( 'Name', 'borderless'),
143                                'type' => Controls_Manager::TEXT,
144                'dynamic' => [
145                    'active' => true,
146                ],
147                                'default' => esc_html__( 'John Doe', 'borderless'),
148                        ]
149                );
150
151                $this->add_control(
152                        'borderless_testimonial_job',
153                        [
154                                'label' => esc_html__( 'Job Position', 'borderless'),
155                                'type' => Controls_Manager::TEXT,
156                'dynamic' => [
157                    'active' => true,
158                ],
159                                'default' => esc_html__( 'Full Stack Web Developer', 'borderless'),
160                        ]
161                );
162
163                $this->add_control(
164                        'borderless_testimonial_description',
165                        [
166                                'label' => esc_html__( 'Description', 'borderless'),
167                                'type' => Controls_Manager::TEXTAREA,
168                'dynamic' => [
169                    'active' => true,
170                ],
171                                'default' => esc_html__( 'Add team member description here. Remove the text if not necessary.', 'borderless'),
172                        ]
173                );
174
175                $this->add_control(
176                        'borderless_testimonial_enable_rating',
177                        [
178                                'label' => esc_html__( 'Display Rating?', 'borderless'),
179                                'type' => Controls_Manager::SWITCHER,
180                                'default' => 'yes',
181                        ]
182                );
183
184
185                $this->add_control(
186                  'borderless_testimonial_rating_number',
187                  [
188                     'label'       => __( 'Rating Number', 'borderless'),
189                     'type' => Controls_Manager::SELECT,
190                     'default' => 'rating-five',
191                     'options' => [
192                        'rating-one'  => __( '1', 'borderless'),
193                        'rating-two' => __( '2', 'borderless'),
194                        'rating-three' => __( '3', 'borderless'),
195                        'rating-four' => __( '4', 'borderless'),
196                        'rating-five'   => __( '5', 'borderless'),
197                     ],
198                        'condition' => [
199                                'borderless_testimonial_enable_rating' => 'yes',
200                        ],
201                  ]
202                );
203
204                $this->end_controls_section();
205
206        /*-----------------------------------------------------------------------------------*/
207        /*  *.  Testimonial - Style
208        /*-----------------------------------------------------------------------------------*/
209
210        $this->start_controls_section(
211                'borderless_section_testimonial_general_styles',
212                [
213                        'label' => esc_html__( 'General', 'borderless'),
214                        'tab' => Controls_Manager::TAB_STYLE
215                ]
216        );
217
218        $this->add_control(
219                'borderless_section_testimonial_general_background',
220                [
221                        'label' => esc_html__( 'Background Color', 'borderless'),
222                        'type' => Controls_Manager::COLOR,
223                        'default' => '',
224                        'selectors' => [
225                                '{{WRAPPER}} .borderless-elementor-testimonial' => 'background-color: {{VALUE}};',
226                        ],
227                ]
228        );
229
230       
231
232        $start = is_rtl() ? 'end' : 'start';
233        $end = is_rtl() ? 'start' : 'end';
234
235        $this->add_responsive_control(
236                'borderless_section_testimonial_general_align',
237                [
238                        'label' => __( 'Alignment', 'borderless' ),
239                        'type' => Controls_Manager::CHOOSE,
240                        'options' => [
241                                'left'    => [
242                                        'title' => __( 'Left', 'borderless' ),
243                                        'icon' => 'eicon-text-align-left',
244                                ],
245                                'center' => [
246                                        'title' => __( 'Center', 'borderless' ),
247                                        'icon' => 'eicon-text-align-center',
248                                ],
249                                'right' => [
250                                        'title' => __( 'Right', 'borderless' ),
251                                        'icon' => 'eicon-text-align-right',
252                                ],
253                        ],
254                        'prefix_class' => 'e-grid-align-',
255                        'default' => 'center',
256                        'selectors' => [
257                                '{{WRAPPER}} .borderless-elementor-testimonial' => 'text-align: {{VALUE}}',
258                        ],
259                ]
260        );
261
262        $this->add_responsive_control(
263                'borderless_section_testimonial_general_margin',
264                [
265                        'label' => esc_html__( 'Margin', 'borderless'),
266                        'type' => Controls_Manager::DIMENSIONS,
267                        'size_units' => [ 'px', 'em', '%', 'rem' ],
268                        'selectors' => [
269                                '{{WRAPPER}} .borderless-elementor-testimonial' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
270                        ],
271                ]
272        );
273
274        $this->add_responsive_control(
275                'borderless_section_testimonial_general_padding',
276                [
277                        'label' => esc_html__( 'Padding', 'borderless'),
278                        'type' => Controls_Manager::DIMENSIONS,
279                        'size_units' => [ 'px', 'em', '%', 'rem' ],
280                        'selectors' => [
281                                '{{WRAPPER}} .borderless-elementor-testimonial' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
282                        ],
283                ]
284        );
285
286        $this->add_group_control(
287                Group_Control_Border::get_type(),
288                [
289                        'name' => 'borderless_section_testimonial_general_border',
290                        'label' => esc_html__( 'Border', 'borderless'),
291                        'selector' => '{{WRAPPER}} .borderless-elementor-testimonial',
292                ]
293        );
294
295        $this->add_control(
296                'borderless_section_testimonial_general_border_radius',
297                [
298                        'label' => esc_html__( 'Border Radius', 'borderless'),
299                        'type' => Controls_Manager::DIMENSIONS,
300                        'selectors' => [
301                                '{{WRAPPER}} .borderless-elementor-testimonial' => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px;',
302                        ],
303                ]
304        );
305
306        $this->end_controls_section();
307
308
309        /*-----------------------------------------------------------------------------------*/
310        /*  *.  Avatar - Style
311        /*-----------------------------------------------------------------------------------*/
312
313        $this->start_controls_section(
314                'borderless_section_testimonial_image_styles',
315                [
316                        'label' => esc_html__( 'Picture', 'borderless'),
317                        'tab' => Controls_Manager::TAB_STYLE
318                ]
319        );
320
321        $this->add_responsive_control(
322                'borderless_testimonial_image_width',
323                [
324                        'label' => esc_html__( 'Width', 'borderless'),
325                        'type' => Controls_Manager::SLIDER,
326                                'default' => [
327                                        'unit' => '%',
328                                ],
329                                'tablet_default' => [
330                                        'unit' => '%',
331                                ],
332                                'mobile_default' => [
333                                        'unit' => '%',
334                                ],
335                                'size_units' => [ '%', 'px', 'vw' ],
336                                'range' => [
337                                        '%' => [
338                                                'min' => 1,
339                                                'max' => 100,
340                                        ],
341                                        'px' => [
342                                                'min' => 1,
343                                                'max' => 1000,
344                                        ],
345                                        'vw' => [
346                                                'min' => 1,
347                                                'max' => 100,
348                                        ],
349                                ],
350                        'selectors' => [
351                                '{{WRAPPER}} .borderless-elementor-testimonial-picture figure img' => 'width:{{SIZE}}{{UNIT}};',
352                        ],
353                ]
354        );
355
356        do_action('borderless/testimonial_circle_controls', $this);
357
358        $this->add_responsive_control(
359                'borderless_testimonial_image_max_width',
360                [
361                        'label' => __( 'Max Width', 'borderless' ),
362                        'type' => Controls_Manager::SLIDER,
363                        'default' => [
364                                'unit' => '%',
365                        ],
366                        'tablet_default' => [
367                                'unit' => '%',
368                        ],
369                        'mobile_default' => [
370                                'unit' => '%',
371                        ],
372                        'size_units' => [ '%', 'px', 'vw' ],
373                        'range' => [
374                                '%' => [
375                                        'min' => 1,
376                                        'max' => 100,
377                                ],
378                                'px' => [
379                                        'min' => 1,
380                                        'max' => 1000,
381                                ],
382                                'vw' => [
383                                        'min' => 1,
384                                        'max' => 100,
385                                ],
386                        ],
387                        'selectors' => [
388                                '{{WRAPPER}} .borderless-elementor-testimonial-picture figure img' => 'max-width:{{SIZE}}{{UNIT}};',
389                        ],
390                ]
391        );
392
393        $this->add_responsive_control(
394                'borderless_testimonial_image_height',
395                [
396                        'label' => __( 'Height', 'borderless' ),
397                        'type' => Controls_Manager::SLIDER,
398                        'default' => [
399                                'unit' => 'px',
400                        ],
401                        'tablet_default' => [
402                                'unit' => 'px',
403                        ],
404                        'mobile_default' => [
405                                'unit' => 'px',
406                        ],
407                        'size_units' => [ 'px', 'vh' ],
408                        'range' => [
409                                'px' => [
410                                        'min' => 1,
411                                        'max' => 500,
412                                ],
413                                'vh' => [
414                                        'min' => 1,
415                                        'max' => 100,
416                                ],
417                        ],
418                        'selectors' => [
419                                '{{WRAPPER}} .borderless-elementor-testimonial-picture figure img' => 'height: {{SIZE}}{{UNIT}};',
420                        ],
421                ]
422        );
423
424        $this->add_responsive_control(
425                'borderless_testimonial_image_margin',
426                [
427                        'label' => esc_html__( 'Margin', 'borderless'),
428                        'type' => Controls_Manager::DIMENSIONS,
429                        'size_units' => [ 'px', 'em', '%', 'rem' ],
430                        'selectors' => [
431                                '{{WRAPPER}} .borderless-elementor-testimonial-picture figure img' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
432                        ],
433                ]
434        );
435
436        $this->add_responsive_control(
437                'borderless_testimonial_image_padding',
438                [
439                        'label' => esc_html__( 'Padding', 'borderless'),
440                        'type' => Controls_Manager::DIMENSIONS,
441                        'size_units' => [ 'px', 'em', '%', 'rem' ],
442                        'selectors' => [
443                                '{{WRAPPER}} .borderless-elementor-testimonial-picture figure img' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
444                        ],
445                ]
446        );
447
448        $this->add_responsive_control(
449                'borderless_testimonial_image_object_fit',
450                [
451                        'label' => __( 'Object Fit', 'borderless' ),
452                        'type' => Controls_Manager::SELECT,
453                        'condition' => [
454                                'height[size]!' => '',
455                        ],
456                        'options' => [
457                                '' => __( 'Default', 'borderless' ),
458                                'fill' => __( 'Fill', 'borderless' ),
459                                'cover' => __( 'Cover', 'borderless' ),
460                                'contain' => __( 'Contain', 'borderless' ),
461                        ],
462                        'default' => '',
463                        'selectors' => [
464                                '{{WRAPPER}} .borderless-elementor-testimonial-picture figure img' => 'object-fit: {{VALUE}};',
465                        ],
466                ]
467        );
468
469        $this->add_control(
470                'borderless_testimonial_image_separator_panel_style',
471                [
472                        'type' => Controls_Manager::DIVIDER,
473                        'style' => 'thick',
474                ]
475        );
476
477        $this->start_controls_tabs( 'borderless_testimonial_image_effects' );
478
479        $this->start_controls_tab( 'normal',
480                [
481                        'label' => __( 'Normal', 'borderless' ),
482                ]
483        );
484
485        $this->add_control(
486                'borderless_testimonial_image_opacity',
487                [
488                        'label' => __( 'Opacity', 'borderless' ),
489                        'type' => Controls_Manager::SLIDER,
490                        'range' => [
491                                'px' => [
492                                        'max' => 1,
493                                        'min' => 0.10,
494                                        'step' => 0.01,
495                                ],
496                        ],
497                        'selectors' => [
498                                '{{WRAPPER}} .borderless-elementor-testimonial-picture figure img' => 'opacity: {{SIZE}};',
499                        ],
500                ]
501        );
502
503        $this->add_group_control(
504                Group_Control_Css_Filter::get_type(),
505                [
506                        'name' => 'borderless_testimonial_image_css_filters',
507                        'selector' => '{{WRAPPER}} .borderless-elementor-testimonial-picture figure img',
508                ]
509        );
510
511        $this->end_controls_tab();
512
513        $this->start_controls_tab( 'hover',
514                [
515                        'label' => __( 'Hover', 'borderless' ),
516                ]
517        );
518
519        $this->add_control(
520                'borderless_testimonial_image_opacity_hover',
521                [
522                        'label' => __( 'Opacity', 'borderless' ),
523                        'type' => Controls_Manager::SLIDER,
524                        'range' => [
525                                'px' => [
526                                        'max' => 1,
527                                        'min' => 0.10,
528                                        'step' => 0.01,
529                                ],
530                        ],
531                        'selectors' => [
532                                '{{WRAPPER}} .borderless-elementor-testimonial-social-profiles figure:hover img' => 'opacity: {{SIZE}};',
533                        ],
534                ]
535        );
536
537        $this->add_group_control(
538                Group_Control_Css_Filter::get_type(),
539                [
540                        'name' => 'borderless_testimonial_image_css_filters_hover',
541                        'selector' => '{{WRAPPER}} .borderless-elementor-testimonial-social-profiles figure:hover img',
542                ]
543        );
544
545        $this->add_control(
546                'borderless_testimonial_image_background_hover_transition',
547                [
548                        'label' => __( 'Transition Duration', 'borderless' ),
549                        'type' => Controls_Manager::SLIDER,
550                        'range' => [
551                                'px' => [
552                                        'max' => 3,
553                                        'step' => 0.1,
554                                ],
555                        ],
556                        'selectors' => [
557                                '{{WRAPPER}} .borderless-elementor-testimonial-picture figure img' => 'transition-duration: {{SIZE}}s',
558                        ],
559                ]
560        );
561
562        $this->add_control(
563                'borderless_testimonial_image_hover_animation',
564                [
565                        'label' => __( 'Hover Animation', 'borderless' ),
566                        'type' => Controls_Manager::HOVER_ANIMATION,
567                ]
568        );
569
570        $this->end_controls_tab();
571
572        $this->end_controls_tabs();
573
574        $this->add_group_control(
575                Group_Control_Border::get_type(),
576                [
577                        'name' => 'borderless_testimonial_image_border',
578                        'selector' => '{{WRAPPER}} .borderless-elementor-testimonial-picture figure img',
579                        'separator' => 'before',
580                ]
581        );
582
583        $this->add_responsive_control(
584                'borderless_testimonial_image_border_radius',
585                [
586                        'label' => __( 'Border Radius', 'borderless' ),
587                        'type' => Controls_Manager::DIMENSIONS,
588                        'size_units' => [ 'px', '%' ],
589                        'selectors' => [
590                                '{{WRAPPER}} .borderless-elementor-testimonial-picture figure img' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
591                        ],
592                ]
593        );
594
595        $this->add_group_control(
596                Group_Control_Box_Shadow::get_type(),
597                [
598                        'name' => 'borderless_testimonial_image_box_shadow',
599                        'exclude' => [
600                                'box_shadow_position',
601                        ],
602                        'selector' => '{{WRAPPER}} .borderless-elementor-testimonial-picture figure img',
603                ]
604        );
605
606        $this->end_controls_section();
607
608
609        /*-----------------------------------------------------------------------------------*/
610        /*  *.  Content - Style
611        /*-----------------------------------------------------------------------------------*/
612
613        $this->start_controls_section(
614                'borderless_section_testimonial_content_style',
615                [
616                        'label' => esc_html__( 'Content', 'borderless'),
617                        'tab' => Controls_Manager::TAB_STYLE
618                ]
619        );
620
621        $this->add_control(
622                'borderless_section_testimonial_content_heading_style',
623                [
624                        'label' => __( 'Content Card', 'borderless'),
625                        'type' => Controls_Manager::HEADING,
626                        'separator'     => 'before'
627                ]
628        );
629
630        $this->add_control(
631                'borderless_section_testimonial_content__height',
632                [
633                        'label' => esc_html__( 'Height', 'borderless'),
634                        'type' => Controls_Manager::SLIDER,
635                        'size_units'    => [ 'px', 'em' ],
636                        'range' => [
637                                'px' => [
638                                        'min' => 0,
639                                        'max' => 500,
640                                ],
641                                'em'    => [
642                                        'min'   => 0,
643                                        'max'   => 200
644                                ]
645                        ],
646                        'default'       => [
647                                'unit'  => 'px',
648                                'size'  => 'auto'
649                        ],
650                        'selectors' => [
651                                '{{WRAPPER}} .borderless-elementor-testimonial-content' => 'min-height: {{SIZE}}{{UNIT}};',
652                        ],
653                ]
654        );
655
656        $this->add_control(
657                'borderless_testimonial_content_color_name',
658                [
659                        'label' => esc_html__( 'Color Name', 'borderless'),
660                        'type' => Controls_Manager::COLOR,
661                        'default' => '#000',
662                        'selectors' => [
663                                '{{WRAPPER}} .borderless-elementor-testimonial-name' => 'color: {{VALUE}};',
664                        ],
665                ]
666        );
667
668        $this->add_group_control(
669                Group_Control_Typography::get_type(),
670                [
671                        'label' => esc_html__( 'Typography Name', 'borderless'),
672                        'name' => 'borderless_testimonial_typography_name',
673                        'selector' => '{{WRAPPER}} .borderless-elementor-testimonial-name',
674                ]
675        );
676
677        $this->add_control(
678                'borderless_testimonial_content_color_job_position',
679                [
680                        'label' => esc_html__( 'Color Job Position', 'borderless'),
681                        'type' => Controls_Manager::COLOR,
682                        'default' => '#000',
683                        'selectors' => [
684                                '{{WRAPPER}} .borderless-elementor-testimonial-job' => 'color: {{VALUE}};',
685                        ],
686                ]
687        );
688
689        $this->add_group_control(
690                Group_Control_Typography::get_type(),
691                [
692                        'label' => esc_html__( 'Typography Job Position', 'borderless'),
693                        'name' => 'borderless_testimonial_typography_job',
694                        'selector' => '{{WRAPPER}} .borderless-elementor-testimonial-job',
695                ]
696        );
697
698        $this->add_control(
699                'borderless_testimonial_content_color_description',
700                [
701                        'label' => esc_html__( 'Color Description', 'borderless'),
702                        'type' => Controls_Manager::COLOR,
703                        'default' => '#000',
704                        'selectors' => [
705                                '{{WRAPPER}} .borderless-elementor-testimonial-description' => 'color: {{VALUE}};',
706                        ],
707                ]
708        );
709
710        $this->add_group_control(
711                Group_Control_Typography::get_type(),
712                [
713                        'label' => esc_html__( 'Typography Description', 'borderless'),
714                        'name' => 'borderless_testimonial_typography_description',
715                        'selector' => '{{WRAPPER}} .borderless-elementor-testimonial-description',
716                ]
717        );
718
719        $this->add_control(
720                'borderless_section_testimonial_content_background',
721                [
722                        'label' => esc_html__( 'Content Background Color', 'borderless'),
723                        'type' => Controls_Manager::COLOR,
724                        'default' => '',
725                        'selectors' => [
726                                '{{WRAPPER}} .borderless-elementor-testimonial-content' => 'background-color: {{VALUE}};',
727                        ],
728                ]
729        );
730
731       
732
733        $start = is_rtl() ? 'end' : 'start';
734        $end = is_rtl() ? 'start' : 'end';
735
736        $this->add_responsive_control(
737                'borderless_section_testimonial_content_align',
738                [
739                        'label' => __( 'Alignment', 'borderless' ),
740                        'type' => Controls_Manager::CHOOSE,
741                        'options' => [
742                                'left'    => [
743                                        'title' => __( 'Left', 'borderless' ),
744                                        'icon' => 'eicon-text-align-left',
745                                ],
746                                'center' => [
747                                        'title' => __( 'Center', 'borderless' ),
748                                        'icon' => 'eicon-text-align-center',
749                                ],
750                                'right' => [
751                                        'title' => __( 'Right', 'borderless' ),
752                                        'icon' => 'eicon-text-align-right',
753                                ],
754                        ],
755                        'prefix_class' => 'e-grid-align-',
756                        'default' => 'center',
757                        'selectors' => [
758                                '{{WRAPPER}} .borderless-elementor-testimonial-content' => 'text-align: {{VALUE}}',
759                        ],
760                ]
761        );
762
763        $this->add_responsive_control(
764                'borderless_section_testimonial_content_margin',
765                [
766                        'label' => esc_html__( 'Margin', 'borderless'),
767                        'type' => Controls_Manager::DIMENSIONS,
768                        'size_units' => [ 'px', 'em', '%', 'rem' ],
769                        'selectors' => [
770                                '{{WRAPPER}} .borderless-elementor-testimonial-content' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
771                        ],
772                ]
773        );
774
775        $this->add_responsive_control(
776                'borderless_section_testimonial_content_padding',
777                [
778                        'label' => esc_html__( 'Padding', 'borderless'),
779                        'type' => Controls_Manager::DIMENSIONS,
780                        'size_units' => [ 'px', 'em', '%', 'rem' ],
781                        'selectors' => [
782                                '{{WRAPPER}} .borderless-elementor-testimonial-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
783                        ],
784                ]
785        );
786
787        $this->add_group_control(
788                Group_Control_Border::get_type(),
789                [
790                        'name' => 'borderless_section_testimonial_content_border',
791                        'label' => esc_html__( 'Border', 'borderless'),
792                        'selector' => '{{WRAPPER}} .borderless-elementor-testimonial-content',
793                ]
794        );
795
796        $this->add_control(
797                'borderless_section_testimonial_content_radius',
798                [
799                        'label' => esc_html__( 'Border Radius', 'borderless'),
800                        'type' => Controls_Manager::DIMENSIONS,
801                        'selectors' => [
802                                '{{WRAPPER}} .borderless-elementor-testimonial-content' => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px;',
803                        ],
804                ]
805        );
806
807        $this->end_controls_section();
808
809        /*-----------------------------------------------------------------------------------*/
810        /*  *.  Quotation - Style
811        /*-----------------------------------------------------------------------------------*/
812
813        $this->start_controls_section(
814                'borderless_section_testimonial_quotation_style',
815                [
816                        'label' => esc_html__( 'Quotation', 'borderless'),
817                        'tab' => Controls_Manager::TAB_STYLE
818                ]
819        );
820
821        $this->add_group_control(
822                Group_Control_Typography::get_type(),
823                [
824                 'name' => 'borderless_testimonial_quotation_typography',
825                        'selector' => '{{WRAPPER}} .borderless-elementor-testimonial-quote',
826                ]
827        );
828
829        $this->add_control(
830                'borderless_section_testimonial_quotation_color',
831                [
832                        'label' => esc_html__( 'Color', 'borderless'),
833                        'type' => Controls_Manager::COLOR,
834                        'default' => 'rgba(0,0,0,0.15)',
835                        'selectors' => [
836                                '{{WRAPPER}} .borderless-elementor-testimonial-quote' => 'color: {{VALUE}};',
837                        ],
838                ]
839        );
840
841        $this->add_responsive_control(
842                'borderless_section_testimonial_content_position',
843                [
844                        'label' => esc_html__( 'Position', 'borderless'),
845                        'type' => Controls_Manager::DIMENSIONS,
846                        'size_units' => [ 'px', 'em', '%', 'rem' ],
847                        'selectors' => [
848                                '{{WRAPPER}} .borderless-elementor-testimonial-quote' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
849                        ],
850                ]
851        );
852
853        $this->end_controls_section();
854
855        }
856
857        protected function borderless_elementor_testimonial_rating() {
858                $settings = $this->get_settings_for_display('borderless_testimonial_enable_rating');
859
860                if ( $settings == 'yes' ) :
861                        ob_start();
862                ?>
863                <ul class="borderless-elementor-testimonial-star-rating">
864                        <li><i class="fas fa-star" aria-hidden="true"></i></li>
865                        <li><i class="fas fa-star" aria-hidden="true"></i></li>
866                        <li><i class="fas fa-star" aria-hidden="true"></i></li>
867                        <li><i class="fas fa-star" aria-hidden="true"></i></li>
868                        <li><i class="fas fa-star" aria-hidden="true"></i></li>
869                </ul>
870                <?php
871                        echo ob_get_clean();
872                endif;
873        }
874
875        protected function borderless_elementor_testimonial_quote() {
876                echo '<span class="borderless-elementor-testimonial-quote"></span>';
877        }
878       
879        protected function render() {
880                $settings = $this->get_settings_for_display();
881                $rating = $this->get_settings_for_display('borderless_testimonial_enable_rating');
882       
883                $this->add_render_attribute(
884                        'borderless_testimonial_wrap',
885                        [
886                                'id'    => 'borderless-testimonial-' . esc_attr($this->get_id()),
887                                'class' => [
888                                        'borderless-elementor-testimonial',
889                                ]
890                        ]
891                );
892       
893                if ($rating == 'yes') {
894                        $this->add_render_attribute('borderless_testimonial_wrap', 'class', esc_attr($this->get_settings('borderless_testimonial_rating_number')));
895                }
896       
897                ?>
898       
899                <div <?php echo $this->get_render_attribute_string('borderless_testimonial_wrap'); ?>>
900       
901                <?php if (!empty($settings['borderless_testimonial_picture']['url'])) {
902                        echo '
903                        <div class="borderless-elementor-testimonial-picture"> 
904                                <figure>
905                                        <img src="' . esc_url($settings['borderless_testimonial_picture']['url']) . '">
906                                </figure>
907                        </div>
908                        '; 
909                }
910       
911                echo '<div class="borderless-elementor-testimonial-content">';
912       
913                if (!empty($settings['borderless_testimonial_description'])) {
914                        echo '<p class="borderless-elementor-testimonial-description">' . esc_html($settings['borderless_testimonial_description']) . '</p>';
915                }
916       
917                $this->borderless_elementor_testimonial_rating($settings);
918       
919                if (!empty($settings['borderless_testimonial_name'])) {
920                        echo '<h5 class="borderless-elementor-testimonial-name">' . esc_html($settings['borderless_testimonial_name']) . '</h5>';
921                }
922                if (!empty($settings['borderless_testimonial_job'])) {
923                        echo '<p class="borderless-elementor-testimonial-job">' . esc_html($settings['borderless_testimonial_job']) . '</p>';
924                }       
925                echo '</div>';
926                $this->borderless_elementor_testimonial_quote();
927                echo '</div>';
928        }
929       
930       
931        protected function _content_template() {
932
933    }
934       
935       
936}
Note: See TracBrowser for help on using the repository browser.