PluginProbe
Elementor Website Builder – more than just a page builder / 3.24.8
Elementor Website Builder – more than just a page builder v3.24.8
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/traits/button-trait.php +31 -47 4.2.0-dev23.24.8 View file →
@@ -10,12 +10,11 @@
10 10 use Elementor\Group_Control_Text_Shadow;
11 11 use Elementor\Group_Control_Typography;
12 12 use Elementor\Icons_Manager;
13 13 use Elementor\Widget_Base;
14 -use Elementor\Plugin;
15 14
16 15 if ( ! defined( 'ABSPATH' ) ) {
17 - exit; // Exit if accessed directly.
16 + exit; // Exit if accessed directly
18 17 }
19 18
20 19 trait Button_Trait {
21 20 /**
@@ -132,8 +131,11 @@
132 131 'icon_exclude_inline_options' => $args['icon_exclude_inline_options'],
133 132 ]
134 133 );
135 134
135 + $start = is_rtl() ? 'right' : 'left';
136 + $end = is_rtl() ? 'left' : 'right';
137 +
136 138 $this->add_control(
137 139 'icon_align',
138 140 [
139 141 'label' => esc_html__( 'Icon Position', 'elementor' ),
@@ -141,16 +143,15 @@
141 143 'default' => is_rtl() ? 'row-reverse' : 'row',
142 144 'options' => [
143 145 'row' => [
144 146 'title' => esc_html__( 'Start', 'elementor' ),
145 - 'icon' => 'eicon-h-align-left',
147 + 'icon' => "eicon-h-align-{$start}",
146 148 ],
147 149 'row-reverse' => [
148 150 'title' => esc_html__( 'End', 'elementor' ),
149 - 'icon' => 'eicon-h-align-right',
151 + 'icon' => "eicon-h-align-{$end}",
150 152 ],
151 153 ],
152 - 'classes' => 'elementor-control-start-end',
153 154 'selectors_dictionary' => [
154 155 'left' => is_rtl() ? 'row-reverse' : 'row',
155 156 'right' => is_rtl() ? 'row' : 'row-reverse',
156 157 ],
@@ -210,10 +211,9 @@
210 211 ],
211 212 'default' => '',
212 213 'title' => esc_html__( 'Add your custom id WITHOUT the Pound key. e.g: my-id', 'elementor' ),
213 214 'description' => sprintf(
214 - /* translators: 1: `<code>` opening tag, 2: `</code>` closing tag. */
215 - esc_html__( 'Please make sure the ID is unique and not used elsewhere on the page. This field allows %1$sA-z 0-9%2$s & underscore chars without spaces.', 'elementor' ),
215 + esc_html__( 'Please make sure the ID is unique and not used elsewhere on the page this form is displayed. This field allows %1$sA-z 0-9%2$s & underscore chars without spaces.', 'elementor' ),
216 216 '<code>',
217 217 '</code>'
218 218 ),
219 219 'separator' => 'before',
@@ -272,8 +272,11 @@
272 272 'condition' => $args['section_condition'],
273 273 ]
274 274 );
275 275
276 + $start = is_rtl() ? 'right' : 'left';
277 + $end = is_rtl() ? 'left' : 'right';
278 +
276 279 $this->add_responsive_control(
277 280 'content_align',
278 281 [
279 282 'label' => esc_html__( 'Alignment', 'elementor' ),
@@ -280,9 +283,9 @@
280 283 'type' => Controls_Manager::CHOOSE,
281 284 'options' => [
282 285 'start' => [
283 286 'title' => esc_html__( 'Start', 'elementor' ),
284 - 'icon' => 'eicon-text-align-left',
287 + 'icon' => "eicon-text-align-{$start}",
285 288 ],
286 289 'center' => [
287 290 'title' => esc_html__( 'Center', 'elementor' ),
288 291 'icon' => 'eicon-text-align-center',
@@ -288,9 +291,9 @@
288 291 'icon' => 'eicon-text-align-center',
289 292 ],
290 293 'end' => [
291 294 'title' => esc_html__( 'End', 'elementor' ),
292 - 'icon' => 'eicon-text-align-right',
295 + 'icon' => "eicon-text-align-{$end}",
293 296 ],
294 297 'space-between' => [
295 298 'title' => esc_html__( 'Space between', 'elementor' ),
296 299 'icon' => 'eicon-text-align-justify',
@@ -296,9 +299,8 @@
296 299 'icon' => 'eicon-text-align-justify',
297 300 ],
298 301 ],
299 302 'default' => $args['content_alignment_default'],
300 - 'classes' => 'elementor-control-start-end',
301 303 'selectors' => [
302 304 '{{WRAPPER}} .elementor-button .elementor-button-content-wrapper' => 'justify-content: {{VALUE}};',
303 305 ],
304 306 'condition' => array_merge( $args['section_condition'], [ 'align' => 'justify' ] ),
@@ -371,17 +373,8 @@
371 373 'condition' => $args['section_condition'],
372 374 ]
373 375 );
374 376
375 - $this->add_group_control(
376 - Group_Control_Box_Shadow::get_type(),
377 - [
378 - 'name' => 'button_box_shadow',
379 - 'selector' => '{{WRAPPER}} .elementor-button',
380 - 'condition' => $args['section_condition'],
381 - ]
382 - );
383 -
384 377 $this->end_controls_tab();
385 378
386 379 $this->start_controls_tab(
387 380 'tab_button_hover',
@@ -424,8 +417,11 @@
424 417 'button_hover_border_color',
425 418 [
426 419 'label' => esc_html__( 'Border Color', 'elementor' ),
427 420 'type' => Controls_Manager::COLOR,
421 + 'condition' => [
422 + 'border_border!' => '',
423 + ],
428 424 'selectors' => [
429 425 '{{WRAPPER}} .elementor-button:hover, {{WRAPPER}} .elementor-button:focus' => 'border-color: {{VALUE}};',
430 426 ],
431 427 'condition' => $args['section_condition'],
@@ -431,17 +427,8 @@
431 427 'condition' => $args['section_condition'],
432 428 ]
433 429 );
434 430
435 - $this->add_group_control(
436 - Group_Control_Box_Shadow::get_type(),
437 - [
438 - 'name' => 'button_hover_box_shadow',
439 - 'selector' => '{{WRAPPER}} .elementor-button:hover, {{WRAPPER}} .elementor-button:focus',
440 - 'condition' => $args['section_condition'],
441 - ]
442 - );
443 -
444 431 $this->add_control(
445 432 'button_hover_transition_duration',
446 433 [
447 434 'label' => esc_html__( 'Transition Duration', 'elementor' ),
@@ -491,8 +478,17 @@
491 478 'condition' => $args['section_condition'],
492 479 ]
493 480 );
494 481
482 + $this->add_group_control(
483 + Group_Control_Box_Shadow::get_type(),
484 + [
485 + 'name' => 'button_box_shadow',
486 + 'selector' => '{{WRAPPER}} .elementor-button',
487 + 'condition' => $args['section_condition'],
488 + ]
489 + );
490 +
495 491 $this->add_responsive_control(
496 492 'text_padding',
497 493 [
498 494 'label' => esc_html__( 'Padding', 'elementor' ),
@@ -516,9 +512,9 @@
516 512 *
517 513 * @since 3.4.0
518 514 * @access protected
519 515 */
520 - protected function render_button( ?Widget_Base $instance = null ) {
516 + protected function render_button( Widget_Base $instance = null ) {
521 517 if ( empty( $instance ) ) {
522 518 $instance = $this;
523 519 }
524 520
@@ -527,10 +523,8 @@
527 523 if ( empty( $settings['text'] ) && empty( $settings['selected_icon']['value'] ) ) {
528 524 return;
529 525 }
530 526
531 - $optimized_markup = Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
532 -
533 527 $instance->add_render_attribute( 'wrapper', 'class', 'elementor-button-wrapper' );
534 528
535 529 $instance->add_render_attribute( 'button', 'class', 'elementor-button' );
536 530
@@ -554,17 +548,13 @@
554 548 if ( ! empty( $settings['hover_animation'] ) ) {
555 549 $instance->add_render_attribute( 'button', 'class', 'elementor-animation-' . $settings['hover_animation'] );
556 550 }
557 551 ?>
558 - <?php if ( ! $optimized_markup ) : ?>
559 552 <div <?php $instance->print_render_attribute_string( 'wrapper' ); ?>>
560 - <?php endif; ?>
561 553 <a <?php $instance->print_render_attribute_string( 'button' ); ?>>
562 554 <?php $this->render_text( $instance ); ?>
563 555 </a>
564 - <?php if ( ! $optimized_markup ) : ?>
565 556 </div>
566 - <?php endif; ?>
567 557 <?php
568 558 }
569 559
570 560 /**
@@ -581,16 +571,14 @@
581 571 if ( '' === settings.text && '' === settings.selected_icon.value ) {
582 572 return;
583 573 }
584 574
585 - const optimized_markup = elementorCommon.config.experimentalFeatures.e_optimized_markup;
586 -
587 575 view.addRenderAttribute( 'wrapper', 'class', 'elementor-button-wrapper' );
588 576
589 577 view.addRenderAttribute( 'button', 'class', 'elementor-button' );
590 578
591 - if ( '' !== settings.link?.url ) {
592 - view.addRenderAttribute( 'button', 'href', elementor.helpers.sanitizeUrl( settings.link?.url ) );
579 + if ( '' !== settings.link.url ) {
580 + view.addRenderAttribute( 'button', 'href', elementor.helpers.sanitizeUrl( settings.link.url ) );
593 581 view.addRenderAttribute( 'button', 'class', 'elementor-button-link' );
594 582 } else {
595 583 view.addRenderAttribute( 'button', 'role', 'button' );
596 584 }
@@ -612,11 +600,9 @@
612 600 view.addInlineEditingAttributes( 'text', 'none' );
613 601 var iconHTML = elementor.helpers.renderIcon( view, settings.selected_icon, { 'aria-hidden': true }, 'i' , 'object' ),
614 602 migrated = elementor.helpers.isIconMigrated( settings, 'selected_icon' );
615 603 #>
616 - <# if ( ! optimized_markup ) { #>
617 604 <div {{{ view.getRenderAttributeString( 'wrapper' ) }}}>
618 - <# } #>
619 605 <a {{{ view.getRenderAttributeString( 'button' ) }}}>
620 606 <span class="elementor-button-content-wrapper">
621 607 <# if ( settings.icon || settings.selected_icon ) { #>
622 608 <span {{{ view.getRenderAttributeString( 'icon' ) }}}>
@@ -627,15 +613,13 @@
627 613 <# } #>
628 614 </span>
629 615 <# } #>
630 616 <# if ( settings.text ) { #>
631 - <span {{{ view.getRenderAttributeString( 'text' ) }}}>{{ settings.text }}</span>
617 + <span {{{ view.getRenderAttributeString( 'text' ) }}}>{{{ settings.text }}}</span>
632 618 <# } #>
633 619 </span>
634 620 </a>
635 - <# if ( ! optimized_markup ) { #>
636 621 </div>
637 - <# } #>
638 622 <?php
639 623 }
640 624
641 625 /**
@@ -647,9 +631,9 @@
647 631 *
648 632 * @since 3.4.0
649 633 * @access protected
650 634 */
651 - protected function render_text( ?Widget_Base $instance = null ) {
635 + protected function render_text( Widget_Base $instance = null ) {
652 636 // The default instance should be `$this` (a Button widget), unless the Trait is being used from outside of a widget (e.g. `Skin_Base`) which should pass an `$instance`.
653 637 if ( empty( $instance ) ) {
654 638 $instance = $this;
655 639 }
@@ -671,9 +655,9 @@
671 655 ],
672 656 ] );
673 657
674 658 // TODO: replace the protected with public
675 - // $instance->add_inline_editing_attributes( 'text', 'none' );
659 + //$instance->add_inline_editing_attributes( 'text', 'none' );
676 660 ?>
677 661 <span <?php $instance->print_render_attribute_string( 'content-wrapper' ); ?>>
678 662 <?php if ( ! empty( $settings['icon'] ) || ! empty( $settings['selected_icon']['value'] ) ) : ?>
679 663 <span <?php $instance->print_render_attribute_string( 'icon' ); ?>>
@@ -684,9 +668,9 @@
684 668 <?php endif; ?>
685 669 </span>
686 670 <?php endif; ?>
687 671 <?php if ( ! empty( $settings['text'] ) ) : ?>
688 - <span <?php $instance->print_render_attribute_string( 'text' ); ?>><?php echo wp_kses_post( $settings['text'] ); ?></span>
672 + <span <?php $instance->print_render_attribute_string( 'text' ); ?>><?php $this->print_unescaped_setting( 'text' ); ?></span>
689 673 <?php endif; ?>
690 674 </span>
691 675 <?php
692 676 }