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 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 All 453 releases
← All changes | includes/widgets/testimonial.php +55 -118 4.0.93.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>
@@ -570,12 +519,8 @@
570 519 */
571 520 protected function content_template() {
572 521 ?>
573 522 <#
574 - if ( '' === settings.testimonial_content && '' === settings.testimonial_image.url && '' === settings.testimonial_name && '' === settings.testimonial_job ) {
575 - return;
576 - }
577 -
578 523 var image = {
579 524 id: settings.testimonial_image.id,
580 525 url: settings.testimonial_image.url,
581 526 size: settings.testimonial_image_size,
@@ -587,32 +532,24 @@
587 532 if ( '' !== settings.testimonial_image.url ) {
588 533 imageUrl = elementor.imagesManager.getImageUrl( image );
589 534 hasImage = ' elementor-has-image';
590 535
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>';
536 + var imageHtml = '<img src="' + imageUrl + '" alt="testimonial" />';
537 + if ( settings.link.url ) {
538 + imageHtml = '<a href="' + settings.link.url + '">' + imageHtml + '</a>';
594 539 }
595 540 }
596 541
542 + var testimonial_alignment = settings.testimonial_alignment ? ' elementor-testimonial-text-align-' + settings.testimonial_alignment : '';
597 543 var testimonial_image_position = settings.testimonial_image_position ? ' elementor-testimonial-image-position-' + settings.testimonial_image_position : '';
598 544 #>
599 - <div class="elementor-testimonial-wrapper">
545 + <div class="elementor-testimonial-wrapper{{ testimonial_alignment }}">
600 546 <# 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 547 view.addRenderAttribute( 'testimonial_content', 'class', 'elementor-testimonial-content' );
611 548
612 549 view.addInlineEditingAttributes( 'testimonial_content' );
613 550 #>
614 - <div {{{ view.getRenderAttributeString( 'testimonial_content' ) }}}>{{ settings.testimonial_content }}</div>
551 + <div {{{ view.getRenderAttributeString( 'testimonial_content' ) }}}>{{{ settings.testimonial_content }}}</div>
615 552 <# } #>
616 553 <div class="elementor-testimonial-meta{{ hasImage }}{{ testimonial_image_position }}">
617 554 <div class="elementor-testimonial-meta-inner">
618 555 <# if ( imageUrl ) { #>
@@ -634,15 +571,15 @@
634 571 view.addRenderAttribute( 'testimonial_name', 'class', 'elementor-testimonial-name' );
635 572
636 573 view.addInlineEditingAttributes( 'testimonial_name', 'none' );
637 574
638 - if ( settings.link?.url ) {
575 + if ( settings.link.url ) {
639 576 #>
640 - <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>
641 578 <#
642 579 } else {
643 580 #>
644 - <div {{{ view.getRenderAttributeString( 'testimonial_name' ) }}}>{{ settings.testimonial_name }}</div>
581 + <div {{{ view.getRenderAttributeString( 'testimonial_name' ) }}}>{{{ settings.testimonial_name }}}</div>
645 582 <#
646 583 }
647 584 }
648 585
@@ -650,15 +587,15 @@
650 587 view.addRenderAttribute( 'testimonial_job', 'class', 'elementor-testimonial-job' );
651 588
652 589 view.addInlineEditingAttributes( 'testimonial_job', 'none' );
653 590
654 - if ( settings.link?.url ) {
591 + if ( settings.link.url ) {
655 592 #>
656 - <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>
657 594 <#
658 595 } else {
659 596 #>
660 - <div {{{ view.getRenderAttributeString( 'testimonial_job' ) }}}>{{ settings.testimonial_job }}</div>
597 + <div {{{ view.getRenderAttributeString( 'testimonial_job' ) }}}>{{{ settings.testimonial_job }}}</div>
661 598 <#
662 599 }
663 600 }
664 601 #>