PluginProbe
Elementor Website Builder – more than just a page builder / 3.4.0-dev9
Elementor Website Builder – more than just a page builder v3.4.0-dev9
4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 All 452 releases
← All changes | includes/widgets/testimonial.php +55 -144 4.1.33.4.0-dev9 View file →
@@ -6,9 +6,8 @@
6 6 }
7 7
8 8 use Elementor\Core\Kits\Documents\Tabs\Global_Colors;
9 9 use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
10 -use Elementor\Modules\Promotions\Controls\Promotion_Control;
11 10
12 11 /**
13 12 * Elementor testimonial widget.
14 13 *
@@ -73,52 +72,9 @@
73 72 public function get_keywords() {
74 73 return [ 'testimonial', 'blockquote' ];
75 74 }
76 75
77 - protected function is_dynamic_content(): bool {
78 - return false;
79 - }
80 -
81 76 /**
82 - * Get style dependencies.
83 - *
84 - * Retrieve the list of style dependencies the widget requires.
85 - *
86 - * @since 3.24.0
87 - * @access public
88 - *
89 - * @return array Widget style dependencies.
90 - */
91 - public function get_style_depends(): array {
92 - return [ 'widget-testimonial' ];
93 - }
94 -
95 - public function has_widget_inner_wrapper(): bool {
96 - return ! Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
97 - }
98 -
99 - /**
100 - * Get widget upsale data.
101 - *
102 - * Retrieve the widget promotion data.
103 - *
104 - * @since 3.18.0
105 - * @access protected
106 - *
107 - * @return array Widget promotion data.
108 - */
109 - protected function get_upsale_data() {
110 - return [
111 - 'condition' => ! Utils::has_pro(),
112 - 'image' => esc_url( ELEMENTOR_ASSETS_URL . 'images/go-pro.svg' ),
113 - 'image_alt' => esc_attr__( 'Upgrade', 'elementor' ),
114 - 'description' => esc_html__( 'Use interesting masonry layouts and other overlay features with Elementor\'s Pro Gallery widget.', 'elementor' ),
115 - 'upgrade_url' => esc_url( 'https://go.elementor.com/go-pro-testimonial-widget/' ),
116 - 'upgrade_text' => esc_html__( 'Upgrade Now', 'elementor' ),
117 - ];
118 - }
119 -
120 - /**
121 77 * Register testimonial widget controls.
122 78 *
123 79 * Adds different input fields to allow the user to change and customize the widget settings.
124 80 *
@@ -164,8 +120,9 @@
164 120 Group_Control_Image_Size::get_type(),
165 121 [
166 122 'name' => 'testimonial_image', // Usage: `{name}_size` and `{name}_custom_dimension`, in this case `testimonial_image_size` and `testimonial_image_custom_dimension`.
167 123 'default' => 'full',
124 + 'separator' => 'none',
168 125 ]
169 126 );
170 127
171 128 $this->add_control(
@@ -175,12 +132,9 @@
175 132 'type' => Controls_Manager::TEXT,
176 133 'dynamic' => [
177 134 'active' => true,
178 135 ],
179 - 'ai' => [
180 - 'active' => false,
181 - ],
182 - 'default' => esc_html__( 'John Doe', 'elementor' ),
136 + 'default' => 'John Doe',
183 137 ]
184 138 );
185 139
186 140 $this->add_control(
@@ -190,12 +144,9 @@
190 144 'type' => Controls_Manager::TEXT,
191 145 'dynamic' => [
192 146 'active' => true,
193 147 ],
194 - 'ai' => [
195 - 'active' => false,
196 - ],
197 - 'default' => esc_html__( 'Designer', 'elementor' ),
148 + 'default' => 'Designer',
198 149 ]
199 150 );
200 151
201 152 $this->add_control(
@@ -205,8 +156,9 @@
205 156 'type' => Controls_Manager::URL,
206 157 'dynamic' => [
207 158 'active' => true,
208 159 ],
160 + 'placeholder' => esc_html__( 'https://your-link.com', 'elementor' ),
209 161 ]
210 162 );
211 163
212 164 $this->add_control(
@@ -212,31 +164,23 @@
212 164 $this->add_control(
213 165 'testimonial_image_position',
214 166 [
215 167 'label' => esc_html__( 'Image Position', 'elementor' ),
216 - 'type' => Controls_Manager::CHOOSE,
168 + 'type' => Controls_Manager::SELECT,
217 169 'default' => 'aside',
218 170 'options' => [
219 - 'aside' => [
220 - 'title' => esc_html__( 'Aside', 'elementor' ),
221 - 'icon' => 'eicon-h-align-left',
222 - ],
223 - 'top' => [
224 - 'title' => esc_html__( 'Top', 'elementor' ),
225 - 'icon' => 'eicon-v-align-top',
226 - ],
171 + 'aside' => esc_html__( 'Aside', 'elementor' ),
172 + 'top' => esc_html__( 'Top', 'elementor' ),
227 173 ],
228 - 'toggle' => false,
229 174 'condition' => [
230 175 'testimonial_image[url]!' => '',
231 176 ],
232 177 'separator' => 'before',
233 - 'classes' => 'elementor-control-start-end',
234 178 'style_transfer' => true,
235 179 ]
236 180 );
237 181
238 - $this->add_responsive_control(
182 + $this->add_control(
239 183 'testimonial_alignment',
240 184 [
241 185 'label' => esc_html__( 'Alignment', 'elementor' ),
242 186 'type' => Controls_Manager::CHOOSE,
@@ -241,10 +185,10 @@
241 185 'label' => esc_html__( 'Alignment', 'elementor' ),
242 186 'type' => Controls_Manager::CHOOSE,
243 187 'default' => 'center',
244 188 'options' => [
245 - 'start' => [
246 - 'title' => esc_html__( 'Start', 'elementor' ),
189 + 'left' => [
190 + 'title' => esc_html__( 'Left', 'elementor' ),
247 191 'icon' => 'eicon-text-align-left',
248 192 ],
249 193 'center' => [
250 194 'title' => esc_html__( 'Center', 'elementor' ),
@@ -249,25 +193,26 @@
249 193 'center' => [
250 194 'title' => esc_html__( 'Center', 'elementor' ),
251 195 'icon' => 'eicon-text-align-center',
252 196 ],
253 - 'end' => [
254 - 'title' => esc_html__( 'End', 'elementor' ),
197 + 'right' => [
198 + 'title' => esc_html__( 'Right', 'elementor' ),
255 199 'icon' => 'eicon-text-align-right',
256 200 ],
257 201 ],
258 - 'classes' => 'elementor-control-start-end',
259 - 'selectors_dictionary' => [
260 - 'left' => is_rtl() ? 'end' : 'start',
261 - 'right' => is_rtl() ? 'start' : 'end',
262 - ],
263 - 'selectors' => [
264 - '{{WRAPPER}} .elementor-testimonial-wrapper' => 'text-align: {{VALUE}}',
265 - ],
266 202 'style_transfer' => true,
267 203 ]
268 204 );
269 205
206 + $this->add_control(
207 + 'view',
208 + [
209 + 'label' => esc_html__( 'View', 'elementor' ),
210 + 'type' => Controls_Manager::HIDDEN,
211 + 'default' => 'traditional',
212 + ]
213 + );
214 +
270 215 $this->end_controls_section();
271 216
272 217 // Content.
273 218 $this->start_controls_section(
@@ -325,14 +270,14 @@
325 270 ],
326 271 ]
327 272 );
328 273
329 - $this->add_responsive_control(
274 + $this->add_control(
330 275 'image_size',
331 276 [
332 - 'label' => esc_html__( 'Image Resolution', 'elementor' ),
277 + 'label' => esc_html__( 'Image Size', 'elementor' ),
333 278 'type' => Controls_Manager::SLIDER,
334 - 'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ],
279 + 'size_units' => [ 'px' ],
335 280 'range' => [
336 281 'px' => [
337 282 'min' => 20,
338 283 'max' => 200,
@@ -352,14 +297,14 @@
352 297 'separator' => 'before',
353 298 ]
354 299 );
355 300
356 - $this->add_responsive_control(
301 + $this->add_control(
357 302 'image_border_radius',
358 303 [
359 304 'label' => esc_html__( 'Border Radius', 'elementor' ),
360 305 'type' => Controls_Manager::DIMENSIONS,
361 - 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
306 + 'size_units' => [ 'px', '%' ],
362 307 'selectors' => [
363 308 '{{WRAPPER}} .elementor-testimonial-wrapper .elementor-testimonial-image img' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
364 309 ],
365 310 ]
@@ -468,19 +413,14 @@
468 413 */
469 414 protected function render() {
470 415 $settings = $this->get_settings_for_display();
471 416
472 - $has_content = ! empty( $settings['testimonial_content'] );
473 - $has_image = ! empty( $settings['testimonial_image']['url'] );
474 - $has_name = ! empty( $settings['testimonial_name'] );
475 - $has_job = ! empty( $settings['testimonial_job'] );
417 + $this->add_render_attribute( 'wrapper', 'class', 'elementor-testimonial-wrapper' );
476 418
477 - if ( ! $has_content && ! $has_image && ! $has_name && ! $has_job ) {
478 - return;
419 + if ( $settings['testimonial_alignment'] ) {
420 + $this->add_render_attribute( 'wrapper', 'class', 'elementor-testimonial-text-align-' . $settings['testimonial_alignment'] );
479 421 }
480 422
481 - $this->add_render_attribute( 'wrapper', 'class', 'elementor-testimonial-wrapper' );
482 -
483 423 $this->add_render_attribute( 'meta', 'class', 'elementor-testimonial-meta' );
484 424
485 425 if ( $settings['testimonial_image']['url'] ) {
486 426 $this->add_render_attribute( 'meta', 'class', 'elementor-has-image' );
@@ -489,8 +429,17 @@
489 429 if ( $settings['testimonial_image_position'] ) {
490 430 $this->add_render_attribute( 'meta', 'class', 'elementor-testimonial-image-position-' . $settings['testimonial_image_position'] );
491 431 }
492 432
433 + $has_content = ! ! $settings['testimonial_content'];
434 + $has_image = ! ! $settings['testimonial_image']['url'];
435 + $has_name = ! ! $settings['testimonial_name'];
436 + $has_job = ! ! $settings['testimonial_job'];
437 +
438 + if ( ! $has_content && ! $has_image && ! $has_name && ! $has_job ) {
439 + return;
440 + }
441 +
493 442 if ( ! empty( $settings['link']['url'] ) ) {
494 443 $this->add_link_attributes( 'link', $settings['link'] );
495 444 }
496 445 ?>
@@ -499,9 +448,9 @@
499 448 if ( $has_content ) :
500 449 $this->add_render_attribute( 'testimonial_content', 'class', 'elementor-testimonial-content' );
501 450 $this->add_inline_editing_attributes( 'testimonial_content' );
502 451 ?>
503 - <div <?php $this->print_render_attribute_string( 'testimonial_content' ); ?>><?php echo wp_kses_post( $settings['testimonial_content'] ); ?></div>
452 + <div <?php $this->print_render_attribute_string( 'testimonial_content' ); ?>><?php $this->print_unescaped_setting( 'testimonial_content' ); ?></div>
504 453 <?php endif; ?>
505 454
506 455 <?php if ( $has_image || $has_name || $has_job ) : ?>
507 456 <div <?php $this->print_render_attribute_string( 'meta' ); ?>>
@@ -526,13 +475,13 @@
526 475 $this->add_inline_editing_attributes( 'testimonial_name', 'none' );
527 476
528 477 if ( ! empty( $settings['link']['url'] ) ) :
529 478 ?>
530 - <a <?php $this->print_render_attribute_string( 'testimonial_name' ); ?> <?php $this->print_render_attribute_string( 'link' ); ?>><?php echo wp_kses_post( $settings['testimonial_name'] ); ?></a>
479 + <a <?php $this->print_render_attribute_string( 'testimonial_name' ); ?> <?php $this->print_render_attribute_string( 'link' ); ?>><?php $this->print_unescaped_setting( 'testimonial_name' ); ?></a>
531 480 <?php
532 481 else :
533 482 ?>
534 - <div <?php $this->print_render_attribute_string( 'testimonial_name' ); ?>><?php echo wp_kses_post( $settings['testimonial_name'] ); ?></div>
483 + <div <?php $this->print_render_attribute_string( 'testimonial_name' ); ?>><?php $this->print_unescaped_setting( 'testimonial_name' ); ?></div>
535 484 <?php
536 485 endif;
537 486 endif; ?>
538 487 <?php
@@ -542,13 +491,13 @@
542 491 $this->add_inline_editing_attributes( 'testimonial_job', 'none' );
543 492
544 493 if ( ! empty( $settings['link']['url'] ) ) :
545 494 ?>
546 - <a <?php $this->print_render_attribute_string( 'testimonial_job' ); ?> <?php $this->print_render_attribute_string( 'link' ); ?>><?php echo wp_kses_post( $settings['testimonial_job'] ); ?></a>
495 + <a <?php $this->print_render_attribute_string( 'testimonial_job' ); ?> <?php $this->print_render_attribute_string( 'link' ); ?>><?php $this->print_unescaped_setting( 'testimonial_job' ); ?></a>
547 496 <?php
548 497 else :
549 498 ?>
550 - <div <?php $this->print_render_attribute_string( 'testimonial_job' ); ?>><?php echo wp_kses_post( $settings['testimonial_job'] ); ?></div>
499 + <div <?php $this->print_render_attribute_string( 'testimonial_job' ); ?>><?php $this->print_unescaped_setting( 'testimonial_job' ); ?></div>
551 500 <?php
552 501 endif;
553 502 endif; ?>
554 503 </div>
@@ -567,41 +516,11 @@
567 516 *
568 517 * @since 2.9.0
569 518 * @access protected
570 519 */
571 - public function render_markdown(): string {
572 - $settings = $this->get_settings_for_display();
573 -
574 - $content = Utils::html_to_plain_text( $settings['testimonial_content'] ?? '' );
575 - $name = Utils::html_to_plain_text( $settings['testimonial_name'] ?? '' );
576 - $job = Utils::html_to_plain_text( $settings['testimonial_job'] ?? '' );
577 -
578 - if ( empty( $content ) && empty( $name ) ) {
579 - return '';
580 - }
581 -
582 - $md = '';
583 -
584 - if ( ! empty( $content ) ) {
585 - $md = '> "' . $content . '"';
586 - }
587 -
588 - $attribution = array_filter( [ $name, $job ] );
589 -
590 - if ( ! empty( $attribution ) ) {
591 - $md .= "\n>\n> -- " . implode( ', ', $attribution );
592 - }
593 -
594 - return $md;
595 - }
596 -
597 520 protected function content_template() {
598 521 ?>
599 522 <#
600 - if ( '' === settings.testimonial_content && '' === settings.testimonial_image.url && '' === settings.testimonial_name && '' === settings.testimonial_job ) {
601 - return;
602 - }
603 -
604 523 var image = {
605 524 id: settings.testimonial_image.id,
606 525 url: settings.testimonial_image.url,
607 526 size: settings.testimonial_image_size,
@@ -613,32 +532,24 @@
613 532 if ( '' !== settings.testimonial_image.url ) {
614 533 imageUrl = elementor.imagesManager.getImageUrl( image );
615 534 hasImage = ' elementor-has-image';
616 535
617 - var imageHtml = '<img src="' + _.escape( imageUrl ) + '" alt="testimonial" />';
618 - if ( settings.link?.url ) {
619 - imageHtml = '<a href="' + elementor.helpers.sanitizeUrl( settings.link?.url ) + '">' + imageHtml + '</a>';
536 + var imageHtml = '<img src="' + imageUrl + '" alt="testimonial" />';
537 + if ( settings.link.url ) {
538 + imageHtml = '<a href="' + settings.link.url + '">' + imageHtml + '</a>';
620 539 }
621 540 }
622 541
542 + var testimonial_alignment = settings.testimonial_alignment ? ' elementor-testimonial-text-align-' + settings.testimonial_alignment : '';
623 543 var testimonial_image_position = settings.testimonial_image_position ? ' elementor-testimonial-image-position-' + settings.testimonial_image_position : '';
624 544 #>
625 - <div class="elementor-testimonial-wrapper">
545 + <div class="elementor-testimonial-wrapper{{ testimonial_alignment }}">
626 546 <# if ( '' !== settings.testimonial_content ) {
627 - view.addRenderAttribute( 'testimonial_content', {
628 - 'data-binding-type': 'content',
629 - 'data-binding-setting': 'testimonial_content',
630 - 'data-binding-config': JSON.stringify({
631 - 'testimonial_content': {
632 - editType: "text"
633 - }
634 - })
635 - } );
636 547 view.addRenderAttribute( 'testimonial_content', 'class', 'elementor-testimonial-content' );
637 548
638 549 view.addInlineEditingAttributes( 'testimonial_content' );
639 550 #>
640 - <div {{{ view.getRenderAttributeString( 'testimonial_content' ) }}}>{{ settings.testimonial_content }}</div>
551 + <div {{{ view.getRenderAttributeString( 'testimonial_content' ) }}}>{{{ settings.testimonial_content }}}</div>
641 552 <# } #>
642 553 <div class="elementor-testimonial-meta{{ hasImage }}{{ testimonial_image_position }}">
643 554 <div class="elementor-testimonial-meta-inner">
644 555 <# if ( imageUrl ) { #>
@@ -660,15 +571,15 @@
660 571 view.addRenderAttribute( 'testimonial_name', 'class', 'elementor-testimonial-name' );
661 572
662 573 view.addInlineEditingAttributes( 'testimonial_name', 'none' );
663 574
664 - if ( settings.link?.url ) {
575 + if ( settings.link.url ) {
665 576 #>
666 - <a href="{{ elementor.helpers.sanitizeUrl( settings.link?.url ) }}" {{{ view.getRenderAttributeString( 'testimonial_name' ) }}}>{{ settings.testimonial_name }}</a>
577 + <a href="{{{ settings.link.url }}}" {{{ view.getRenderAttributeString( 'testimonial_name' ) }}}>{{{ settings.testimonial_name }}}</a>
667 578 <#
668 579 } else {
669 580 #>
670 - <div {{{ view.getRenderAttributeString( 'testimonial_name' ) }}}>{{ settings.testimonial_name }}</div>
581 + <div {{{ view.getRenderAttributeString( 'testimonial_name' ) }}}>{{{ settings.testimonial_name }}}</div>
671 582 <#
672 583 }
673 584 }
674 585
@@ -676,15 +587,15 @@
676 587 view.addRenderAttribute( 'testimonial_job', 'class', 'elementor-testimonial-job' );
677 588
678 589 view.addInlineEditingAttributes( 'testimonial_job', 'none' );
679 590
680 - if ( settings.link?.url ) {
591 + if ( settings.link.url ) {
681 592 #>
682 - <a href="{{ elementor.helpers.sanitizeUrl( settings.link?.url ) }}" {{{ view.getRenderAttributeString( 'testimonial_job' ) }}}>{{ settings.testimonial_job }}</a>
593 + <a href="{{{ settings.link.url }}}" {{{ view.getRenderAttributeString( 'testimonial_job' ) }}}>{{{ settings.testimonial_job }}}</a>
683 594 <#
684 595 } else {
685 596 #>
686 - <div {{{ view.getRenderAttributeString( 'testimonial_job' ) }}}>{{ settings.testimonial_job }}</div>
597 + <div {{{ view.getRenderAttributeString( 'testimonial_job' ) }}}>{{{ settings.testimonial_job }}}</div>
687 598 <#
688 599 }
689 600 }
690 601 #>