PluginProbe
Easy Elements for Elementor – Addons & Website Templates / 1.5.0
Easy Elements for Elementor – Addons & Website Templates v1.5.0
1.5.3 1.5.2 1.5.1 1.5.0 1.4.9 1.4.6 1.4.7 1.4.8 1.4.5 1.4.4 1.4.3 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 All 47 releases
easy-elements / widgets / testimonials-grid / testimonials.php

testimonials.php in Easy Elements for Elementor – Addons & Website Templates 1.5.0, at widgets/testimonials-grid/testimonials.php

1,046 lines 39.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Easyel\EasyElements\Widgets;
3 use Elementor\Repeater;
4 use Elementor\Utils;
5 use Elementor\Controls_Manager;
6 use Elementor\Responsive_Control;
7 use Elementor\Group_Control_Image_Size;
8
9 defined( 'ABSPATH' ) || die();
10
11 class Easyel_Testimonials__Widget extends \Elementor\Widget_Base {
12
13 public function get_name() {
14 return 'eel-testimonials';
15 }
16
17 public function get_title() {
18 return esc_html__( 'Testimonials Grid', 'easy-elements' );
19 }
20
21 public function get_icon() {
22 return 'easyicon easyelIcon-testimonials-grid';
23 }
24
25 public function get_categories() {
26 return [ 'easyelements_category' ];
27 }
28
29 public function get_keywords() {
30 return [ 'testimonials', 'clients', 'feedback', 'partner', 'text' ];
31 }
32
33 public function get_style_depends() {
34 return [
35 'eel-testimonials',
36 ];
37 }
38
39 public function get_script_depends() {
40 return [
41 'eel-testimonials',
42 ];
43 }
44
45 protected function register_controls() {
46 $this->start_controls_section(
47 '_section_layout',
48 [
49 'label' => esc_html__( 'Layout Settings', 'easy-elements' ),
50 'tab' => Controls_Manager::TAB_CONTENT,
51 ]
52 );
53
54 $this->add_control(
55 'testimonials_skin',
56 [
57 'label' => esc_html__('Skin Type', 'easy-elements'),
58 'type' => \Elementor\Controls_Manager::SELECT,
59 'default' => 'default',
60 'options' => [
61 'default' => esc_html__('default', 'easy-elements'),
62 'skin1' => esc_html__('Skin 01', 'easy-elements'),
63 'skin2' => esc_html__('Skin 02', 'easy-elements'),
64 'skin3' => esc_html__('Skin 03', 'easy-elements'),
65 'skin4' => esc_html__('Skin 04', 'easy-elements'),
66 'skin5' => esc_html__('Skin 05', 'easy-elements'),
67 'skin6' => esc_html__('Skin 06', 'easy-elements'),
68 ],
69 ]
70 );
71
72 $this->add_control(
73 'avatar_image_top',
74 [
75 'label' => esc_html__('Avatar Image Top', 'easy-elements'),
76 'type' => \Elementor\Controls_Manager::SWITCHER,
77 'default' => '',
78 'label_on' => esc_html__( 'Yes', 'easy-elements' ),
79 'label_off' => esc_html__( 'No', 'easy-elements' ),
80 'return_value' => 'yes',
81 'condition' => [
82 'testimonials_skin' => ['skin2'],
83 ],
84 ]
85 );
86
87 $this->add_control(
88 'show_loadmore',
89 [
90 'label' => esc_html__( 'View All Button', 'easy-elements' ),
91 'type' => \Elementor\Controls_Manager::SWITCHER,
92 'label_on' => esc_html__( 'Show', 'easy-elements' ),
93 'label_off' => esc_html__( 'Hide', 'easy-elements' ),
94 'default' => 'no',
95 'condition' => [
96 'testimonials_skin' => ['skin3'],
97 ],
98 'description' => sprintf(
99 // Translators: %s is the number of items after which the button will work.
100 '<strong>%s</strong>',
101 sprintf(
102 // Translators: %s is the number of items after which the button will work.
103 __('This button will work after %s items', 'easy-elements'),
104 6
105 )
106 ),
107
108 ]
109 );
110
111 $this->add_control(
112 'load_more_text',
113 [
114 'label' => esc_html__('View all reviews', 'easy-elements'),
115 'type' => Controls_Manager::TEXT,
116 'default' => esc_html__( 'View all reviews', 'easy-elements' ),
117 'label_block' => true,
118 'condition' => [
119 'testimonials_skin' => 'skin3',
120 'show_loadmore' => 'yes',
121 ],
122 ]
123 );
124
125 $this->end_controls_section();
126
127 $this->start_controls_section(
128 '_section_logo',
129 [
130 'label' => esc_html__( 'Testimonials Settings', 'easy-elements' ),
131 'tab' => Controls_Manager::TAB_CONTENT,
132 ]
133 );
134
135 $repeater = new Repeater();
136
137 $repeater->add_control(
138 'image',
139 [
140 'label' => esc_html__('Picture', 'easy-elements'),
141 'type' => Controls_Manager::MEDIA,
142 'default' => [
143 'url' => Utils::get_placeholder_image_src(),
144 ],
145 ]
146 );
147
148 $repeater->add_control(
149 'name',
150 [
151 'label' => esc_html__('Name', 'easy-elements'),
152 'type' => Controls_Manager::TEXT,
153 'default' => esc_html__( 'Stefan Sears', 'easy-elements' ),
154 'label_block' => true,
155 ]
156 );
157
158 $repeater->add_control(
159 'designation',
160 [
161 'label' => esc_html__('Designation', 'easy-elements'),
162 'type' => Controls_Manager::TEXT,
163 'default' => esc_html__( 'Developer, Easy Elements Inc', 'easy-elements' ),
164 'label_block' => true,
165 ]
166 );
167
168 $repeater->add_control(
169 'description',
170 [
171 'label' => esc_html__('Description', 'easy-elements'),
172 'type' => Controls_Manager::TEXTAREA,
173 'default' => esc_html__( 'Enter Stefan Sears Description', 'easy-elements' ),
174 ]
175 );
176
177 $repeater->add_control(
178 'quote_icon',
179 [
180 'label' => esc_html__( 'Quote Icon', 'easy-elements' ),
181 'type' => \Elementor\Controls_Manager::ICONS,
182 'label_block' => true,
183 'default' => [
184 'value' => 'fas fa-quote-right',
185 'library' => 'fa-solid',
186 ],
187 'description' => sprintf(
188 '<strong>%s</strong>',
189 __('Only Default skin supported', 'easy-elements')
190 ),
191
192 ]
193 );
194 $repeater->add_control(
195 'show_quote_icon_skin1',
196 [
197 'label' => esc_html__( 'Show Quote Icon on Skin 01', 'easy-elements' ),
198 'type' => \Elementor\Controls_Manager::SWITCHER,
199 'label_on' => esc_html__( 'Show', 'easy-elements' ),
200 'label_off' => esc_html__( 'Hide', 'easy-elements' ),
201 'return_value' => 'yes',
202 'default' => '',
203 'separator' => 'after',
204 ]
205 );
206 $repeater->add_control(
207 'rating',
208 [
209 'label' => esc_html__( 'Rating', 'easy-elements' ),
210 'type' => \Elementor\Controls_Manager::SELECT,
211 'options' => [
212 '1' => '�
213 ☆☆☆☆',
214 '2' => '�
215
216 ☆☆☆',
217 '3' => '�
218
219
220 ☆☆',
221 '4' => '�
222
223
224
225 ',
226 '5' => '�
227
228
229
230
231 ',
232 ],
233 'default' => '5',
234 'separator' => 'after',
235 'description' => sprintf(
236 '<strong>%s</strong>',
237 __('[skin1, skin2, skin4] skins type not supported', 'easy-elements')
238 ),
239
240 ]
241 );
242 $repeater->add_control(
243 'logo_company',
244 [
245 'label' => esc_html__('Logo', 'easy-elements'),
246 'type' => Controls_Manager::MEDIA,
247 'default' => [ '' ],
248 'description' => sprintf(
249 '<strong>%s</strong>',
250 __('Default skin not supported', 'easy-elements')
251 ),
252
253 ]
254 );
255
256 $this->add_control(
257 'easy_testimonials',
258 [
259 'type' => Controls_Manager::REPEATER,
260 'fields' => $repeater->get_controls(),
261 'title_field' => '{{{ name }}}',
262 'default' => array_fill( 0, 4, [
263 'image' => [ 'url' => Utils::get_placeholder_image_src() ],
264 'name' => esc_html__( 'Stefan Sears', 'easy-elements' ),
265 'description' => esc_html__( 'This service exceeded all my expectations. The team was professional, fast, and truly cared about delivering a top-notch experience from start to finish.', 'easy-elements' ),
266 ]),
267 ]
268 );
269
270 $this->add_group_control(
271 Group_Control_Image_Size::get_type(),
272 [
273 'name' => 'image',
274 'default' => 'full',
275 ]
276 );
277
278 $this->add_control(
279 'show_image',
280 [
281 'label' => esc_html__( 'Show Image', 'easy-elements' ),
282 'type' => \Elementor\Controls_Manager::SWITCHER,
283 'label_on' => esc_html__( 'Show', 'easy-elements' ),
284 'label_off' => esc_html__( 'Hide', 'easy-elements' ),
285 'return_value' => 'yes',
286 'default' => 'yes',
287 ]
288 );
289
290 $this->add_responsive_control(
291 'columns',
292 [
293 'label' => esc_html__( 'Select Columns', 'easy-elements' ),
294 'type' => Controls_Manager::SELECT,
295 'default' => '3',
296 'tablet_default' => '3',
297 'mobile_default' => '2',
298 'options' => [
299 '1' => '1 Column',
300 '2' => '2 Columns',
301 '3' => '3 Columns',
302 '4' => '4 Columns',
303 '5' => '5 Columns',
304 '6' => '6 Columns',
305 ],
306 'selectors' => [
307 '{{WRAPPER}} .e-e-testimonial .grid-item' => 'width: calc(100% / {{VALUE}});',
308 ],
309 'condition' => [
310 'testimonials_skin!' => ['default', 'skin4'],
311 ],
312 ]
313 );
314
315 $this->add_responsive_control(
316 'item_padding',
317 [
318 'label' => esc_html__( 'Item Padding', 'easy-elements' ),
319 'type' => Controls_Manager::DIMENSIONS,
320 'size_units' => [ 'px', 'em', '%' ],
321 'selectors' => [
322 '{{WRAPPER}} .e-e-testimonial .grid-item' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
323 ],
324 ]
325 );
326
327 $this->add_responsive_control(
328 'logo_height',
329 [
330 'label' => esc_html__( 'Logo Height', 'easy-elements' ),
331 'type' => \Elementor\Controls_Manager::SLIDER,
332 'size_units' => [ 'px', 'em', '%' ],
333 'range' => [
334 'px' => [
335 'min' => 20,
336 'max' => 500,
337 ],
338 'em' => [
339 'min' => 1,
340 'max' => 20,
341 ],
342 '%' => [
343 'min' => 1,
344 'max' => 100,
345 ],
346 ],
347 'selectors' => [
348 '{{WRAPPER}} .ee--tstml-inner-wrap.skin1 .eel-company-logo img, {{WRAPPER}} .eel-company-logo img' => 'height: {{SIZE}}{{UNIT}}; width:auto;',
349 ],
350 'condition' => [ 'testimonials_skin!' => 'default' ],
351 'description' => sprintf(
352 '<strong>%s</strong>',
353 esc_html__( 'Works only if a Logo is added to testimonial items', 'easy-elements' )
354 ),
355 ]
356 );
357
358 $this->add_responsive_control(
359 'testimonials_alignment',
360 [
361 'label' => esc_html__( 'Alignment', 'easy-elements' ),
362 'type' => \Elementor\Controls_Manager::CHOOSE,
363 'options' => [
364 'left' => [
365 'title' => esc_html__( 'Left', 'easy-elements' ),
366 'icon' => 'eicon-text-align-left',
367 ],
368 'center' => [
369 'title' => esc_html__( 'Center', 'easy-elements' ),
370 'icon' => 'eicon-text-align-center',
371 ],
372 'right' => [
373 'title' => esc_html__( 'Right', 'easy-elements' ),
374 'icon' => 'eicon-text-align-right',
375 ],
376 ],
377 'default' => '',
378 'selectors' => [
379 '{{WRAPPER}} .ee--tstml-inner-wrap' => 'text-align: {{VALUE}};',
380 '{{WRAPPER}} .ee--tstml-inner-wrap .eel-description' => 'text-align: {{VALUE}};',
381 '{{WRAPPER}} .ee--tstml-inner-wrap .eel-author' => 'text-align: {{VALUE}};',
382 '{{WRAPPER}} .ee--tstml-inner-wrap .eel-name' => 'text-align: {{VALUE}};',
383 '{{WRAPPER}} .ee--tstml-inner-wrap .eel-designation' => 'text-align: {{VALUE}};',
384 '{{WRAPPER}} .ee--tstml-inner-wrap .eel-quote' => 'text-align: {{VALUE}};',
385 '{{WRAPPER}} .ee--tstml-inner-wrap .eel-company-logo' => 'text-align: {{VALUE}};',
386 '{{WRAPPER}} .ee--tstml-inner-wrap .eel-author-wrap' => 'justify-content: {{VALUE}}; text-align: {{VALUE}};',
387 '{{WRAPPER}} .ee--tstml-inner-wrap .eel-rating' => 'justify-content: {{VALUE}}; text-align: {{VALUE}};',
388 ],
389 ]
390 );
391
392 $this->add_control(
393 'show_rating',
394 [
395 'label' => esc_html__( 'Show Rating', 'easy-elements' ),
396 'type' => \Elementor\Controls_Manager::SWITCHER,
397 'label_on' => esc_html__( 'Show', 'easy-elements' ),
398 'label_off' => esc_html__( 'Hide', 'easy-elements' ),
399 'return_value' => 'yes',
400 'default' => 'yes',
401 'condition' => [
402 'testimonials_skin!' => ['skin1','skin2','skin4'],
403 ],
404 ]
405 );
406 $this->add_control(
407 'rating_color',
408 [
409 'label' => esc_html__( 'Rating Color', 'easy-elements' ),
410 'type' => \Elementor\Controls_Manager::COLOR,
411 'selectors' => [
412 '{{WRAPPER}} .eel-rating span.star' => 'color: {{VALUE}};',
413 ],
414 'condition' => [
415 'testimonials_skin!' => ['skin1','skin2','skin4'],
416 'show_rating' => 'yes',
417 ],
418 ]
419 );
420 $this->add_responsive_control(
421 'rating_size',
422 [
423 'label' => esc_html__( 'Rating Size', 'easy-elements' ),
424 'type' => \Elementor\Controls_Manager::SLIDER,
425 'selectors' => [
426 '{{WRAPPER}} .eel-rating span.star' => 'font-size: {{SIZE}}{{UNIT}};',
427 ],
428 'condition' => [
429 'testimonials_skin!' => ['skin1','skin2','skin4'],
430 'show_rating' => 'yes',
431 ],
432 ]
433 );
434
435 $this->add_control(
436 'title_icon',
437 [
438 'label' => esc_html__( 'Title Icon', 'easy-elements' ),
439 'type' => \Elementor\Controls_Manager::ICONS,
440 'label_block' => true,
441 'default' => [
442 'value' => 'fas fa-check-circle',
443 'library' => 'fa-solid',
444 ],
445 'condition' => [
446 'testimonials_skin' => ['skin1'],
447 ],
448 ]
449 );
450
451 $this->end_controls_section();
452
453 $this->start_controls_section(
454 'section_style_item',
455 [
456 'label' => esc_html__( 'Item', 'easy-elements' ),
457 'tab' => \Elementor\Controls_Manager::TAB_STYLE,
458 ]
459 );
460
461
462 $this->add_group_control(
463 \Elementor\Group_Control_Background::get_type(),
464 [
465 'name' => 'bg',
466 'label' => __('Background', 'easy-elements'),
467 'types' => ['classic', 'gradient'],
468 'selector' => '{{WRAPPER}} .ee--tstml-inner-wrap',
469 ]
470 );
471
472 $this->add_group_control(
473 \Elementor\Group_Control_Border::get_type(),
474 [
475 'name' => 'border',
476 'label' => __('Border', 'easy-elements'),
477 'selector' => '{{WRAPPER}} .ee--tstml-inner-wrap',
478 ]
479 );
480
481
482 $this->add_control(
483 'border_radius',
484 [
485 'label' => __('Border Radius', 'easy-elements'),
486 'type' => \Elementor\Controls_Manager::DIMENSIONS,
487 'size_units' => ['px', '%', 'em'],
488 'selectors' => [
489 '{{WRAPPER}} .ee--tstml-inner-wrap' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
490 ],
491 ]
492 );
493
494 $this->add_group_control(
495 \Elementor\Group_Control_Box_Shadow::get_type(),
496 [
497 'name' => 'box_shadow',
498 'label' => __('Box Shadow', 'easy-elements'),
499 'selector' => '{{WRAPPER}} .ee--tstml-inner-wrap',
500 ]
501 );
502
503 $this->add_responsive_control(
504 'padding',
505 [
506 'label' => __('Padding', 'easy-elements'),
507 'type' => \Elementor\Controls_Manager::DIMENSIONS,
508 'size_units' => ['px', 'em', '%'],
509 'selectors' => [
510 '{{WRAPPER}} .ee--tstml-inner-wrap' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
511 ],
512 ]
513 );
514
515 $this->add_responsive_control(
516 'wrapper_gap',
517 [
518 'label' => __('Gap', 'easy-elements'),
519 'type' => \Elementor\Controls_Manager::SLIDER,
520 'size_units' => ['px', 'em', '%'],
521 'selectors' => [
522 '{{WRAPPER}} .ee--tstml-inner-wrap' => 'gap: {{SIZE}}{{UNIT}};',
523 ],
524 'condition' => [
525 'testimonials_skin' => 'default'
526 ]
527 ]
528 );
529
530 $this->end_controls_section();
531
532
533 $this->start_controls_section(
534 '_section_name',
535 [
536 'label' => esc_html__( 'Name', 'easy-elements' ),
537 'tab' => Controls_Manager::TAB_STYLE,
538 ]
539 );
540
541 $this->add_control(
542 'name_color',
543 [
544 'label' => esc_html__( 'Color', 'easy-elements' ),
545 'type' => \Elementor\Controls_Manager::COLOR,
546 'selectors' => [
547 '{{WRAPPER}} .ee--tstml-inner-wrap .eel-name' => 'color: {{VALUE}};',
548 ],
549 ]
550 );
551
552 $this->add_group_control(
553 \Elementor\Group_Control_Typography::get_type(),
554 [
555 'name' => 'name_typography',
556 'label' => esc_html__( 'Typography', 'easy-elements' ),
557 'selector' => '{{WRAPPER}} .ee--tstml-inner-wrap .eel-name',
558 ]
559 );
560 $this->add_responsive_control(
561 'name_margin',
562 [
563 'label' => __('Margin', 'easy-elements'),
564 'type' => \Elementor\Controls_Manager::DIMENSIONS,
565 'size_units' => ['px', '%', 'em'],
566 'selectors' => [
567 '{{WRAPPER}} .ee--tstml-inner-wrap .eel-author-wrap' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
568 ],
569 ]
570 );
571
572 $this->end_controls_section();
573
574 $this->start_controls_section(
575 '_section_designation',
576 [
577 'label' => esc_html__( 'Designation', 'easy-elements' ),
578 'tab' => Controls_Manager::TAB_STYLE,
579 ]
580 );
581
582 $this->add_control(
583 'designation_color',
584 [
585 'label' => esc_html__( 'Color', 'easy-elements' ),
586 'type' => \Elementor\Controls_Manager::COLOR,
587 'selectors' => [
588 '{{WRAPPER}} .ee--tstml-inner-wrap .eel-designation' => 'color: {{VALUE}};',
589 ],
590 ]
591 );
592
593 $this->add_group_control(
594 \Elementor\Group_Control_Typography::get_type(),
595 [
596 'name' => 'designation_typography',
597 'label' => esc_html__( 'Typography', 'easy-elements' ),
598 'selector' => '{{WRAPPER}} .ee--tstml-inner-wrap .eel-designation',
599 ]
600 );
601
602 $this->end_controls_section();
603
604 $this->start_controls_section(
605 '_section_description',
606 [
607 'label' => esc_html__( 'Description', 'easy-elements' ),
608 'tab' => Controls_Manager::TAB_STYLE,
609 ]
610 );
611 $this->add_control(
612 'description_color',
613 [
614 'label' => esc_html__( 'Color', 'easy-elements' ),
615 'type' => \Elementor\Controls_Manager::COLOR,
616 'selectors' => [
617 '{{WRAPPER}} .ee--tstml-inner-wrap .eel-description' => 'color: {{VALUE}};',
618 ],
619 ]
620 );
621
622 $this->add_group_control(
623 \Elementor\Group_Control_Typography::get_type(),
624 [
625 'name' => 'description_typography',
626 'label' => esc_html__( 'Typography', 'easy-elements' ),
627 'selector' => '{{WRAPPER}} .ee--tstml-inner-wrap .eel-description',
628 ]
629 );
630
631 $this->add_responsive_control(
632 'description_margin',
633 [
634 'label' => esc_html__( 'Description Margin', 'easy-elements' ),
635 'type' => \Elementor\Controls_Manager::DIMENSIONS,
636 'size_units' => [ 'px', '%', 'em' ],
637 'selectors' => [
638 '{{WRAPPER}} .ee--tstml-inner-wrap .eel-description' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
639 ],
640 ]
641 );
642
643 $this->add_responsive_control(
644 'min_height',
645 [
646 'label' => esc_html__( 'Min Height', 'easy-elements' ),
647 'type' => \Elementor\Controls_Manager::SLIDER,
648 'size_units' => [ 'px', 'em', '%' ],
649 'range' => [
650 'px' => [
651 'min' => 20,
652 'max' => 500,
653 ],
654 'em' => [
655 'min' => 1,
656 'max' => 20,
657 ],
658 '%' => [
659 'min' => 1,
660 'max' => 100,
661 ],
662 ],
663 'selectors' => [
664 '{{WRAPPER}} .ee--tstml-inner-wrap .eel-description' => 'min-height: {{SIZE}}{{UNIT}}; width:auto;',
665 ],
666 ]
667 );
668
669 $this->add_responsive_control(
670 'max_width',
671 [
672 'label' => esc_html__( 'Max Width', 'easy-elements' ),
673 'type' => \Elementor\Controls_Manager::SLIDER,
674 'size_units' => [ 'px', 'em', '%' ],
675 'range' => [
676 'px' => [
677 'min' => 20,
678 'max' => 500,
679 ],
680 'em' => [
681 'min' => 1,
682 'max' => 20,
683 ],
684 '%' => [
685 'min' => 1,
686 'max' => 100,
687 ],
688 ],
689 'selectors' => [
690 '{{WRAPPER}} .ee--tstml-inner-wrap .eel-description' => 'max-width: {{SIZE}}{{UNIT}};',
691 ],
692 ]
693 );
694
695 $this->end_controls_section();
696
697 $this->start_controls_section(
698 'author_image',
699 [
700 'label' => esc_html__( 'Author Image Settings', 'easy-elements' ),
701 'tab' => \Elementor\Controls_Manager::TAB_STYLE,
702 'condition' => [
703 'show_image' => 'yes',
704 ],
705 ]
706 );
707
708 $this->add_control(
709 'author_meta_alignment',
710 [
711 'label' => esc_html__( 'Author Info Alignment', 'easy-elements' ),
712 'type' => \Elementor\Controls_Manager::CHOOSE,
713 'options' => [
714 'flex-start' => [
715 'title' => esc_html__( 'flex-start', 'easy-elements' ),
716 'icon' => 'eicon-h-align-left',
717 ],
718 'center' => [
719 'title' => esc_html__( 'item-center', 'easy-elements' ),
720 'icon' => 'eicon-h-align-center',
721 ],
722 'flex-end' => [
723 'title' => esc_html__( 'flex-end', 'easy-elements' ),
724 'icon' => 'eicon-h-align-right',
725 ],
726 ],
727 'default' => 'flex-start',
728 'selectors' => [
729 '{{WRAPPER}} .ee--tstml-inner-wrap .eel-author-wrap' => 'align-items: {{VALUE}};',
730 ],
731 ]
732 );
733
734 $this->add_responsive_control(
735 'author_meta_alignment_style4',
736 [
737 'label' => esc_html__( 'Alignment', 'easy-elements' ),
738 'type' => \Elementor\Controls_Manager::CHOOSE,
739 'options' => [
740 'left' => [
741 'title' => esc_html__( 'Left', 'easy-elements' ),
742 'icon' => 'eicon-text-align-left',
743 ],
744 'center' => [
745 'title' => esc_html__( 'Center', 'easy-elements' ),
746 'icon' => 'eicon-text-align-center',
747 ],
748 'right' => [
749 'title' => esc_html__( 'Right', 'easy-elements' ),
750 'icon' => 'eicon-text-align-right',
751 ],
752 ],
753 'default' => 'left',
754 'selectors' => [
755 '{{WRAPPER}} .ee--tstml-inner-wrap.skin4 .eel-author' => 'text-align: {{VALUE}};',
756 ],
757 'condition' => [
758 'testimonials_skin' => 'skin4',
759 ],
760 ]
761 );
762
763 $this->add_responsive_control(
764 'author_meta_gap',[
765 'label' => esc_html__( 'Author Info Gap', 'easy-elements' ),
766 'type' => \Elementor\Controls_Manager::DIMENSIONS,
767 'size_units' => [ 'px', 'em', '%' ],
768 'selectors' => [
769 '{{WRAPPER}} .ee--tstml-inner-wrap .eel-author-wrap .eel-picture' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
770 ],
771 ]
772 );
773
774 $this->add_responsive_control(
775 'author_image_size',
776 [
777 'label' => esc_html__( 'Image Size', 'easy-elements' ),
778 'type' => \Elementor\Controls_Manager::SLIDER,
779 'size_units' => [ 'px' ],
780 'range' => [
781 'px' => [
782 'min' => 0,
783 'max' => 1000,
784 ],
785 ],
786 'default' => [
787 'size' => 50,
788 'unit' => 'px',
789 ],
790 'selectors' => [
791 '{{WRAPPER}} .eel-author-wrap .eel-picture img' => 'width: {{SIZE}}{{UNIT}} !important; height: {{SIZE}}{{UNIT}} !important; object-fit: cover;',
792 '{{WRAPPER}} .eel-picture img' => 'width: {{SIZE}}{{UNIT}} !important; height: {{SIZE}}{{UNIT}} !important; object-fit: cover;',
793 ],
794 ]
795 );
796 $this->add_responsive_control(
797 'author_image_border_radius',
798 [
799 'label' => esc_html__( 'Border Radius', 'easy-elements' ),
800 'type' => Controls_Manager::DIMENSIONS,
801 'size_units' => [ 'px', 'em', '%' ],
802 'selectors' => [
803 '{{WRAPPER}} .eel-author-wrap .eel-picture img' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
804 '{{WRAPPER}} .eel-picture img' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
805 ],
806 ]
807 );
808
809 $this->end_controls_section();
810
811 $this->start_controls_section(
812 'quote_icon_styles',
813 [
814 'label' => esc_html__( 'Quote Icon', 'easy-elements' ),
815 'tab' => \Elementor\Controls_Manager::TAB_STYLE,
816 'condition' => [
817 'testimonials_skin' => ['default', 'skin1'],
818 ],
819 ]
820 );
821
822 $this->add_control(
823 'quote_icon_color',
824 [
825 'label' => esc_html__( 'Color', 'easy-elements' ),
826 'type' => \Elementor\Controls_Manager::COLOR,
827 'selectors' => [
828 '{{WRAPPER}} .eel-quote svg' => 'fill: {{VALUE}};',
829 '{{WRAPPER}} .eel-quote svg path' => 'fill: {{VALUE}};',
830 ],
831 'description' => sprintf(
832 '<strong>%s</strong>',
833 esc_html__( 'Works only if a Quote Icon is added to testimonial items', 'easy-elements' )
834 ),
835 ]
836 );
837 $this->add_responsive_control(
838 'quote_icon_size',
839 [
840 'label' => esc_html__( 'Size', 'easy-elements' ),
841 'type' => \Elementor\Controls_Manager::SLIDER,
842 'selectors' => [
843 '{{WRAPPER}} .eel-quote svg' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};',
844 ],
845 ]
846 );
847 $this->end_controls_section();
848
849 // Style 3 View All Button
850 $this->start_controls_section(
851 'style3_view_all_button',
852 [
853 'label' => esc_html__( 'View All Button', 'easy-elements' ),
854 'tab' => \Elementor\Controls_Manager::TAB_STYLE,
855 'condition' => [
856 'testimonials_skin' => 'skin3',
857 'show_loadmore' => 'yes',
858 ],
859 ]
860 );
861 $this->add_group_control(
862 \Elementor\Group_Control_Typography::get_type(),
863 [
864 'name' => 'load_more_typography',
865 'label' => esc_html__( 'Typography', 'easy-elements' ),
866 'selector' => '{{WRAPPER}} .eel-testimonial-more-btn',
867 ]
868 );
869 $this->add_control(
870 'load_more_color',
871 [
872 'label' => esc_html__( 'Color', 'easy-elements' ),
873 'type' => \Elementor\Controls_Manager::COLOR,
874 'selectors' => [
875 '{{WRAPPER}} .eel-testimonial-more-btn' => 'color: {{VALUE}}',
876 ],
877 ]
878 );
879 $this->add_group_control(
880 \Elementor\Group_Control_Background::get_type(),
881 [
882 'name' => 'load_more_bg',
883 'label' => esc_html__('Background', 'easy-elements'),
884 'types' => [ 'classic', 'gradient' ],
885 'selector' => '{{WRAPPER}} .eel-testimonial-more-btn',
886 ]
887 );
888 $this->add_responsive_control(
889 'loadmore_padding',
890 [
891 'label' => esc_html__( 'Padding', 'easy-elements' ),
892 'type' => Controls_Manager::DIMENSIONS,
893 'size_units' => [ 'px', 'em', '%' ],
894 'selectors' => [
895 '{{WRAPPER}} .eel-testimonial-more-btn' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
896 ],
897 ]
898 );
899 $this->add_responsive_control(
900 'loadmore_border_radius',
901 [
902 'label' => esc_html__( 'Border Radius', 'easy-elements' ),
903 'type' => Controls_Manager::DIMENSIONS,
904 'size_units' => [ 'px', 'em', '%' ],
905 'selectors' => [
906 '{{WRAPPER}} .eel-testimonial-more-btn' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
907 ],
908 ]
909 );
910 $this->add_group_control(
911 \Elementor\Group_Control_Border::get_type(),
912 [
913 'name' => 'load_more_border',
914 'label' => __('Border', 'easy-elements'),
915 'selector' => '{{WRAPPER}} .eel-testimonial-more-btn',
916 ]
917 );
918 $this->add_control(
919 'load_more_hover_bg_heading',
920 [
921 'label' => esc_html__( 'Hover Style', 'easy-elements' ),
922 'type' => \Elementor\Controls_Manager::HEADING,
923 'separator' => 'before',
924 ]
925 );
926 $this->add_control(
927 'load_more_hover_color',
928 [
929 'label' => esc_html__( 'Hover Color', 'easy-elements' ),
930 'type' => \Elementor\Controls_Manager::COLOR,
931 'selectors' => [
932 '{{WRAPPER}} .eel-testimonial-more-btn:hover' => 'color: {{VALUE}}',
933 ],
934 ]
935 );
936 $this->add_group_control(
937 \Elementor\Group_Control_Background::get_type(),
938 [
939 'name' => 'load_more_hover_bg',
940 'label' => esc_html__('Hover Background', 'easy-elements'),
941 'types' => [ 'classic', 'gradient' ],
942 'selector' => '{{WRAPPER}} .eel-testimonial-more-btn:hover',
943 ]
944 );
945 $this->add_control(
946 'load_more_hover_border_color',
947 [
948 'label' => esc_html__( 'Hover Border Color', 'easy-elements' ),
949 'type' => \Elementor\Controls_Manager::COLOR,
950 'selectors' => [
951 '{{WRAPPER}} .eel-testimonial-more-btn:hover' => 'border-color: {{VALUE}}',
952 ],
953 ]
954 );
955
956 $this->end_controls_section();
957
958 }
959
960 protected function render() {
961 $settings = $this->get_settings_for_display();
962 if ( empty( $settings['easy_testimonials'] ) ) {
963 return;
964 }
965 ?>
966
967 <div class="e-e-testimonial grid-layout">
968 <div class="grid-wrap">
969 <?php $count = 0; foreach ( $settings['easy_testimonials'] as $item ) :
970 $count++;
971 $image_id = $item['image']['id'] ?? '';
972 // Safely get image size, supporting both array and string cases
973 if ( isset( $settings['image_size'] ) ) {
974 if ( is_array( $settings['image_size'] ) && isset( $settings['image_size']['size'] ) ) {
975 $image_size = $settings['image_size']['size'];
976 } else {
977 $image_size = $settings['image_size'];
978 }
979 } else {
980 $image_size = 'full';
981 }
982 if ( $image_id ) {
983 $image_data = wp_get_attachment_image_src( $image_id, $image_size );
984 $alt = get_post_meta( $image_id, '_wp_attachment_image_alt', true );
985 $title = get_the_title( $image_id );
986 } else {
987 $fallback_url = Utils::get_placeholder_image_src();
988 $image_data = [ $fallback_url, 600, 400 ];
989 $alt = esc_attr__( 'Sample Image', 'easy-elements' );
990 $title = esc_attr__( 'Sample Image', 'easy-elements' );
991 }
992
993 $logo_company_id = $item['logo_company']['id'] ?? '';
994 if ( $logo_company_id ) {
995 $logo_data = wp_get_attachment_image_src( $logo_company_id, $image_size );
996 $logo_url = $logo_data[0] ?? '';
997 $logo_alt = get_post_meta( $logo_company_id, '_wp_attachment_image_alt', true );
998 $logo_title = get_the_title( $logo_company_id );
999 }
1000
1001 $raw_skin = $settings['testimonials_skin'] ?? 'default';
1002 // Sanitize to a slug so the value can never contain
1003 // path separators, dots, or anything that could let
1004 // realpath() resolve outside skins/ below.
1005 $skin = preg_replace( '/[^a-z0-9_-]/i', '', (string) $raw_skin );
1006 if ( '' === $skin ) {
1007 $skin = 'default';
1008 }
1009
1010 $skins_root = realpath( plugin_dir_path( __FILE__ ) . 'skins' );
1011 $skin_target = false !== $skins_root
1012 ? realpath( $skins_root . DIRECTORY_SEPARATOR . $skin . '.php' )
1013 : false;
1014
1015 $classes = 'not-hidden';
1016 if ( isset( $count ) && $count > 6 ) {
1017 $classes .= ' eel-hidden-testimonial';
1018 }
1019 ?>
1020 <div class="grid-item <?php echo esc_attr($classes); ?> testimonials--<?php echo esc_attr($skin); ?>">
1021 <div class="ee--testimonial">
1022 <?php
1023 if ( false !== $skin_target
1024 && false !== $skins_root
1025 && 0 === strpos( $skin_target, $skins_root . DIRECTORY_SEPARATOR )
1026 && substr( $skin_target, -4 ) === '.php'
1027 ) {
1028 include $skin_target;
1029 }
1030 ?>
1031 </div>
1032 </div>
1033 <?php endforeach; ?>
1034 </div>
1035 <?php if ( $count > 6 ) : ?>
1036 <?php if($settings['show_loadmore'] == 'yes'): ?>
1037 <div class="eel-testimonial-more-btn"> <?php echo esc_html($settings['load_more_text']); ?> </div>
1038 <?php endif; ?>
1039 <?php endif; ?>
1040 </div>
1041 <?php
1042 }
1043 }
1044
1045
1046