PluginProbe
Elementor Website Builder – more than just a page builder / 3.6.3
Elementor Website Builder – more than just a page builder v3.6.3
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 +49 -114 4.0.73.6.3 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,26 +164,18 @@
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
@@ -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,18 +193,13 @@
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 202 'selectors' => [
264 203 '{{WRAPPER}} .elementor-testimonial-wrapper' => 'text-align: {{VALUE}}',
265 204 ],
266 205 'style_transfer' => true,
@@ -266,8 +205,17 @@
266 205 'style_transfer' => true,
267 206 ]
268 207 );
269 208
209 + $this->add_control(
210 + 'view',
211 + [
212 + 'label' => esc_html__( 'View', 'elementor' ),
213 + 'type' => Controls_Manager::HIDDEN,
214 + 'default' => 'traditional',
215 + ]
216 + );
217 +
270 218 $this->end_controls_section();
271 219
272 220 // Content.
273 221 $this->start_controls_section(
@@ -325,14 +273,14 @@
325 273 ],
326 274 ]
327 275 );
328 276
329 - $this->add_responsive_control(
277 + $this->add_control(
330 278 'image_size',
331 279 [
332 - 'label' => esc_html__( 'Image Resolution', 'elementor' ),
280 + 'label' => esc_html__( 'Image Size', 'elementor' ),
333 281 'type' => Controls_Manager::SLIDER,
334 - 'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ],
282 + 'size_units' => [ 'px' ],
335 283 'range' => [
336 284 'px' => [
337 285 'min' => 20,
338 286 'max' => 200,
@@ -352,14 +300,14 @@
352 300 'separator' => 'before',
353 301 ]
354 302 );
355 303
356 - $this->add_responsive_control(
304 + $this->add_control(
357 305 'image_border_radius',
358 306 [
359 307 'label' => esc_html__( 'Border Radius', 'elementor' ),
360 308 'type' => Controls_Manager::DIMENSIONS,
361 - 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
309 + 'size_units' => [ 'px', '%' ],
362 310 'selectors' => [
363 311 '{{WRAPPER}} .elementor-testimonial-wrapper .elementor-testimonial-image img' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
364 312 ],
365 313 ]
@@ -468,17 +416,8 @@
468 416 */
469 417 protected function render() {
470 418 $settings = $this->get_settings_for_display();
471 419
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'] );
476 -
477 - if ( ! $has_content && ! $has_image && ! $has_name && ! $has_job ) {
478 - return;
479 - }
480 -
481 420 $this->add_render_attribute( 'wrapper', 'class', 'elementor-testimonial-wrapper' );
482 421
483 422 $this->add_render_attribute( 'meta', 'class', 'elementor-testimonial-meta' );
484 423
@@ -489,8 +428,17 @@
489 428 if ( $settings['testimonial_image_position'] ) {
490 429 $this->add_render_attribute( 'meta', 'class', 'elementor-testimonial-image-position-' . $settings['testimonial_image_position'] );
491 430 }
492 431
432 + $has_content = ! ! $settings['testimonial_content'];
433 + $has_image = ! ! $settings['testimonial_image']['url'];
434 + $has_name = ! ! $settings['testimonial_name'];
435 + $has_job = ! ! $settings['testimonial_job'];
436 +
437 + if ( ! $has_content && ! $has_image && ! $has_name && ! $has_job ) {
438 + return;
439 + }
440 +
493 441 if ( ! empty( $settings['link']['url'] ) ) {
494 442 $this->add_link_attributes( 'link', $settings['link'] );
495 443 }
496 444 ?>
@@ -499,9 +447,9 @@
499 447 if ( $has_content ) :
500 448 $this->add_render_attribute( 'testimonial_content', 'class', 'elementor-testimonial-content' );
501 449 $this->add_inline_editing_attributes( 'testimonial_content' );
502 450 ?>
503 - <div <?php $this->print_render_attribute_string( 'testimonial_content' ); ?>><?php echo wp_kses_post( $settings['testimonial_content'] ); ?></div>
451 + <div <?php $this->print_render_attribute_string( 'testimonial_content' ); ?>><?php $this->print_unescaped_setting( 'testimonial_content' ); ?></div>
504 452 <?php endif; ?>
505 453
506 454 <?php if ( $has_image || $has_name || $has_job ) : ?>
507 455 <div <?php $this->print_render_attribute_string( 'meta' ); ?>>
@@ -526,13 +474,13 @@
526 474 $this->add_inline_editing_attributes( 'testimonial_name', 'none' );
527 475
528 476 if ( ! empty( $settings['link']['url'] ) ) :
529 477 ?>
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>
478 + <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 479 <?php
532 480 else :
533 481 ?>
534 - <div <?php $this->print_render_attribute_string( 'testimonial_name' ); ?>><?php echo wp_kses_post( $settings['testimonial_name'] ); ?></div>
482 + <div <?php $this->print_render_attribute_string( 'testimonial_name' ); ?>><?php $this->print_unescaped_setting( 'testimonial_name' ); ?></div>
535 483 <?php
536 484 endif;
537 485 endif; ?>
538 486 <?php
@@ -542,13 +490,13 @@
542 490 $this->add_inline_editing_attributes( 'testimonial_job', 'none' );
543 491
544 492 if ( ! empty( $settings['link']['url'] ) ) :
545 493 ?>
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>
494 + <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 495 <?php
548 496 else :
549 497 ?>
550 - <div <?php $this->print_render_attribute_string( 'testimonial_job' ); ?>><?php echo wp_kses_post( $settings['testimonial_job'] ); ?></div>
498 + <div <?php $this->print_render_attribute_string( 'testimonial_job' ); ?>><?php $this->print_unescaped_setting( 'testimonial_job' ); ?></div>
551 499 <?php
552 500 endif;
553 501 endif; ?>
554 502 </div>
@@ -570,12 +518,8 @@
570 518 */
571 519 protected function content_template() {
572 520 ?>
573 521 <#
574 - if ( '' === settings.testimonial_content && '' === settings.testimonial_image.url && '' === settings.testimonial_name && '' === settings.testimonial_job ) {
575 - return;
576 - }
577 -
578 522 var image = {
579 523 id: settings.testimonial_image.id,
580 524 url: settings.testimonial_image.url,
581 525 size: settings.testimonial_image_size,
@@ -587,11 +531,11 @@
587 531 if ( '' !== settings.testimonial_image.url ) {
588 532 imageUrl = elementor.imagesManager.getImageUrl( image );
589 533 hasImage = ' elementor-has-image';
590 534
591 - var imageHtml = '<img src="' + _.escape( imageUrl ) + '" alt="testimonial" />';
592 - if ( settings.link?.url ) {
593 - imageHtml = '<a href="' + elementor.helpers.sanitizeUrl( settings.link?.url ) + '">' + imageHtml + '</a>';
535 + var imageHtml = '<img src="' + imageUrl + '" alt="testimonial" />';
536 + if ( settings.link.url ) {
537 + imageHtml = '<a href="' + settings.link.url + '">' + imageHtml + '</a>';
594 538 }
595 539 }
596 540
597 541 var testimonial_image_position = settings.testimonial_image_position ? ' elementor-testimonial-image-position-' + settings.testimonial_image_position : '';
@@ -597,22 +541,13 @@
597 541 var testimonial_image_position = settings.testimonial_image_position ? ' elementor-testimonial-image-position-' + settings.testimonial_image_position : '';
598 542 #>
599 543 <div class="elementor-testimonial-wrapper">
600 544 <# if ( '' !== settings.testimonial_content ) {
601 - view.addRenderAttribute( 'testimonial_content', {
602 - 'data-binding-type': 'content',
603 - 'data-binding-setting': 'testimonial_content',
604 - 'data-binding-config': JSON.stringify({
605 - 'testimonial_content': {
606 - editType: "text"
607 - }
608 - })
609 - } );
610 545 view.addRenderAttribute( 'testimonial_content', 'class', 'elementor-testimonial-content' );
611 546
612 547 view.addInlineEditingAttributes( 'testimonial_content' );
613 548 #>
614 - <div {{{ view.getRenderAttributeString( 'testimonial_content' ) }}}>{{ settings.testimonial_content }}</div>
549 + <div {{{ view.getRenderAttributeString( 'testimonial_content' ) }}}>{{{ settings.testimonial_content }}}</div>
615 550 <# } #>
616 551 <div class="elementor-testimonial-meta{{ hasImage }}{{ testimonial_image_position }}">
617 552 <div class="elementor-testimonial-meta-inner">
618 553 <# if ( imageUrl ) { #>
@@ -634,15 +569,15 @@
634 569 view.addRenderAttribute( 'testimonial_name', 'class', 'elementor-testimonial-name' );
635 570
636 571 view.addInlineEditingAttributes( 'testimonial_name', 'none' );
637 572
638 - if ( settings.link?.url ) {
573 + if ( settings.link.url ) {
639 574 #>
640 - <a href="{{ elementor.helpers.sanitizeUrl( settings.link?.url ) }}" {{{ view.getRenderAttributeString( 'testimonial_name' ) }}}>{{ settings.testimonial_name }}</a>
575 + <a href="{{{ settings.link.url }}}" {{{ view.getRenderAttributeString( 'testimonial_name' ) }}}>{{{ settings.testimonial_name }}}</a>
641 576 <#
642 577 } else {
643 578 #>
644 - <div {{{ view.getRenderAttributeString( 'testimonial_name' ) }}}>{{ settings.testimonial_name }}</div>
579 + <div {{{ view.getRenderAttributeString( 'testimonial_name' ) }}}>{{{ settings.testimonial_name }}}</div>
645 580 <#
646 581 }
647 582 }
648 583
@@ -650,15 +585,15 @@
650 585 view.addRenderAttribute( 'testimonial_job', 'class', 'elementor-testimonial-job' );
651 586
652 587 view.addInlineEditingAttributes( 'testimonial_job', 'none' );
653 588
654 - if ( settings.link?.url ) {
589 + if ( settings.link.url ) {
655 590 #>
656 - <a href="{{ elementor.helpers.sanitizeUrl( settings.link?.url ) }}" {{{ view.getRenderAttributeString( 'testimonial_job' ) }}}>{{ settings.testimonial_job }}</a>
591 + <a href="{{{ settings.link.url }}}" {{{ view.getRenderAttributeString( 'testimonial_job' ) }}}>{{{ settings.testimonial_job }}}</a>
657 592 <#
658 593 } else {
659 594 #>
660 - <div {{{ view.getRenderAttributeString( 'testimonial_job' ) }}}>{{ settings.testimonial_job }}</div>
595 + <div {{{ view.getRenderAttributeString( 'testimonial_job' ) }}}>{{{ settings.testimonial_job }}}</div>
661 596 <#
662 597 }
663 598 }
664 599 #>