| @@ -13,9 +13,9 @@ | ||
| 13 | 13 | use Elementor\Widget_Base; |
| 14 | 14 | use Elementor\Plugin; |
| 15 | 15 | |
| 16 | 16 | if ( ! defined( 'ABSPATH' ) ) { |
| 17 | - exit; // Exit if accessed directly. | |
| 17 | + exit; // Exit if accessed directly | |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | trait Button_Trait { |
| 21 | 21 | /** |
| @@ -132,8 +132,11 @@ | ||
| 132 | 132 | 'icon_exclude_inline_options' => $args['icon_exclude_inline_options'], |
| 133 | 133 | ] |
| 134 | 134 | ); |
| 135 | 135 | |
| 136 | + $start = is_rtl() ? 'right' : 'left'; | |
| 137 | + $end = is_rtl() ? 'left' : 'right'; | |
| 138 | + | |
| 136 | 139 | $this->add_control( |
| 137 | 140 | 'icon_align', |
| 138 | 141 | [ |
| 139 | 142 | 'label' => esc_html__( 'Icon Position', 'elementor' ), |
| @@ -141,16 +144,15 @@ | ||
| 141 | 144 | 'default' => is_rtl() ? 'row-reverse' : 'row', |
| 142 | 145 | 'options' => [ |
| 143 | 146 | 'row' => [ |
| 144 | 147 | 'title' => esc_html__( 'Start', 'elementor' ), |
| 145 | - 'icon' => 'eicon-h-align-left', | |
| 148 | + 'icon' => "eicon-h-align-{$start}", | |
| 146 | 149 | ], |
| 147 | 150 | 'row-reverse' => [ |
| 148 | 151 | 'title' => esc_html__( 'End', 'elementor' ), |
| 149 | - 'icon' => 'eicon-h-align-right', | |
| 152 | + 'icon' => "eicon-h-align-{$end}", | |
| 150 | 153 | ], |
| 151 | 154 | ], |
| 152 | - 'classes' => 'elementor-control-start-end', | |
| 153 | 155 | 'selectors_dictionary' => [ |
| 154 | 156 | 'left' => is_rtl() ? 'row-reverse' : 'row', |
| 155 | 157 | 'right' => is_rtl() ? 'row' : 'row-reverse', |
| 156 | 158 | ], |
| @@ -210,10 +212,9 @@ | ||
| 210 | 212 | ], |
| 211 | 213 | 'default' => '', |
| 212 | 214 | 'title' => esc_html__( 'Add your custom id WITHOUT the Pound key. e.g: my-id', 'elementor' ), |
| 213 | 215 | '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' ), | |
| 216 | + 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 | 217 | '<code>', |
| 217 | 218 | '</code>' |
| 218 | 219 | ), |
| 219 | 220 | 'separator' => 'before', |
| @@ -272,8 +273,11 @@ | ||
| 272 | 273 | 'condition' => $args['section_condition'], |
| 273 | 274 | ] |
| 274 | 275 | ); |
| 275 | 276 | |
| 277 | + $start = is_rtl() ? 'right' : 'left'; | |
| 278 | + $end = is_rtl() ? 'left' : 'right'; | |
| 279 | + | |
| 276 | 280 | $this->add_responsive_control( |
| 277 | 281 | 'content_align', |
| 278 | 282 | [ |
| 279 | 283 | 'label' => esc_html__( 'Alignment', 'elementor' ), |
| @@ -280,9 +284,9 @@ | ||
| 280 | 284 | 'type' => Controls_Manager::CHOOSE, |
| 281 | 285 | 'options' => [ |
| 282 | 286 | 'start' => [ |
| 283 | 287 | 'title' => esc_html__( 'Start', 'elementor' ), |
| 284 | - 'icon' => 'eicon-text-align-left', | |
| 288 | + 'icon' => "eicon-text-align-{$start}", | |
| 285 | 289 | ], |
| 286 | 290 | 'center' => [ |
| 287 | 291 | 'title' => esc_html__( 'Center', 'elementor' ), |
| 288 | 292 | 'icon' => 'eicon-text-align-center', |
| @@ -288,9 +292,9 @@ | ||
| 288 | 292 | 'icon' => 'eicon-text-align-center', |
| 289 | 293 | ], |
| 290 | 294 | 'end' => [ |
| 291 | 295 | 'title' => esc_html__( 'End', 'elementor' ), |
| 292 | - 'icon' => 'eicon-text-align-right', | |
| 296 | + 'icon' => "eicon-text-align-{$end}", | |
| 293 | 297 | ], |
| 294 | 298 | 'space-between' => [ |
| 295 | 299 | 'title' => esc_html__( 'Space between', 'elementor' ), |
| 296 | 300 | 'icon' => 'eicon-text-align-justify', |
| @@ -296,9 +300,8 @@ | ||
| 296 | 300 | 'icon' => 'eicon-text-align-justify', |
| 297 | 301 | ], |
| 298 | 302 | ], |
| 299 | 303 | 'default' => $args['content_alignment_default'], |
| 300 | - 'classes' => 'elementor-control-start-end', | |
| 301 | 304 | 'selectors' => [ |
| 302 | 305 | '{{WRAPPER}} .elementor-button .elementor-button-content-wrapper' => 'justify-content: {{VALUE}};', |
| 303 | 306 | ], |
| 304 | 307 | 'condition' => array_merge( $args['section_condition'], [ 'align' => 'justify' ] ), |
| @@ -371,17 +374,8 @@ | ||
| 371 | 374 | 'condition' => $args['section_condition'], |
| 372 | 375 | ] |
| 373 | 376 | ); |
| 374 | 377 | |
| 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 | 378 | $this->end_controls_tab(); |
| 385 | 379 | |
| 386 | 380 | $this->start_controls_tab( |
| 387 | 381 | 'tab_button_hover', |
| @@ -424,8 +418,11 @@ | ||
| 424 | 418 | 'button_hover_border_color', |
| 425 | 419 | [ |
| 426 | 420 | 'label' => esc_html__( 'Border Color', 'elementor' ), |
| 427 | 421 | 'type' => Controls_Manager::COLOR, |
| 422 | + 'condition' => [ | |
| 423 | + 'border_border!' => '', | |
| 424 | + ], | |
| 428 | 425 | 'selectors' => [ |
| 429 | 426 | '{{WRAPPER}} .elementor-button:hover, {{WRAPPER}} .elementor-button:focus' => 'border-color: {{VALUE}};', |
| 430 | 427 | ], |
| 431 | 428 | 'condition' => $args['section_condition'], |
| @@ -431,17 +428,8 @@ | ||
| 431 | 428 | 'condition' => $args['section_condition'], |
| 432 | 429 | ] |
| 433 | 430 | ); |
| 434 | 431 | |
| 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 | 432 | $this->add_control( |
| 445 | 433 | 'button_hover_transition_duration', |
| 446 | 434 | [ |
| 447 | 435 | 'label' => esc_html__( 'Transition Duration', 'elementor' ), |
| @@ -491,8 +479,17 @@ | ||
| 491 | 479 | 'condition' => $args['section_condition'], |
| 492 | 480 | ] |
| 493 | 481 | ); |
| 494 | 482 | |
| 483 | + $this->add_group_control( | |
| 484 | + Group_Control_Box_Shadow::get_type(), | |
| 485 | + [ | |
| 486 | + 'name' => 'button_box_shadow', | |
| 487 | + 'selector' => '{{WRAPPER}} .elementor-button', | |
| 488 | + 'condition' => $args['section_condition'], | |
| 489 | + ] | |
| 490 | + ); | |
| 491 | + | |
| 495 | 492 | $this->add_responsive_control( |
| 496 | 493 | 'text_padding', |
| 497 | 494 | [ |
| 498 | 495 | 'label' => esc_html__( 'Padding', 'elementor' ), |
| @@ -516,9 +513,9 @@ | ||
| 516 | 513 | * |
| 517 | 514 | * @since 3.4.0 |
| 518 | 515 | * @access protected |
| 519 | 516 | */ |
| 520 | - protected function render_button( ?Widget_Base $instance = null ) { | |
| 517 | + protected function render_button( Widget_Base $instance = null ) { | |
| 521 | 518 | if ( empty( $instance ) ) { |
| 522 | 519 | $instance = $this; |
| 523 | 520 | } |
| 524 | 521 | |
| @@ -587,10 +584,10 @@ | ||
| 587 | 584 | view.addRenderAttribute( 'wrapper', 'class', 'elementor-button-wrapper' ); |
| 588 | 585 | |
| 589 | 586 | view.addRenderAttribute( 'button', 'class', 'elementor-button' ); |
| 590 | 587 | |
| 591 | - if ( '' !== settings.link?.url ) { | |
| 592 | - view.addRenderAttribute( 'button', 'href', elementor.helpers.sanitizeUrl( settings.link?.url ) ); | |
| 588 | + if ( '' !== settings.link.url ) { | |
| 589 | + view.addRenderAttribute( 'button', 'href', elementor.helpers.sanitizeUrl( settings.link.url ) ); | |
| 593 | 590 | view.addRenderAttribute( 'button', 'class', 'elementor-button-link' ); |
| 594 | 591 | } else { |
| 595 | 592 | view.addRenderAttribute( 'button', 'role', 'button' ); |
| 596 | 593 | } |
| @@ -627,9 +624,9 @@ | ||
| 627 | 624 | <# } #> |
| 628 | 625 | </span> |
| 629 | 626 | <# } #> |
| 630 | 627 | <# if ( settings.text ) { #> |
| 631 | - <span {{{ view.getRenderAttributeString( 'text' ) }}}>{{ settings.text }}</span> | |
| 628 | + <span {{{ view.getRenderAttributeString( 'text' ) }}}>{{{ settings.text }}}</span> | |
| 632 | 629 | <# } #> |
| 633 | 630 | </span> |
| 634 | 631 | </a> |
| 635 | 632 | <# if ( ! optimized_markup ) { #> |
| @@ -647,9 +644,9 @@ | ||
| 647 | 644 | * |
| 648 | 645 | * @since 3.4.0 |
| 649 | 646 | * @access protected |
| 650 | 647 | */ |
| 651 | - protected function render_text( ?Widget_Base $instance = null ) { | |
| 648 | + protected function render_text( Widget_Base $instance = null ) { | |
| 652 | 649 | // 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 | 650 | if ( empty( $instance ) ) { |
| 654 | 651 | $instance = $this; |
| 655 | 652 | } |
| @@ -671,9 +668,9 @@ | ||
| 671 | 668 | ], |
| 672 | 669 | ] ); |
| 673 | 670 | |
| 674 | 671 | // TODO: replace the protected with public |
| 675 | - // $instance->add_inline_editing_attributes( 'text', 'none' ); | |
| 672 | + //$instance->add_inline_editing_attributes( 'text', 'none' ); | |
| 676 | 673 | ?> |
| 677 | 674 | <span <?php $instance->print_render_attribute_string( 'content-wrapper' ); ?>> |
| 678 | 675 | <?php if ( ! empty( $settings['icon'] ) || ! empty( $settings['selected_icon']['value'] ) ) : ?> |
| 679 | 676 | <span <?php $instance->print_render_attribute_string( 'icon' ); ?>> |
| @@ -684,9 +681,9 @@ | ||
| 684 | 681 | <?php endif; ?> |
| 685 | 682 | </span> |
| 686 | 683 | <?php endif; ?> |
| 687 | 684 | <?php if ( ! empty( $settings['text'] ) ) : ?> |
| 688 | - <span <?php $instance->print_render_attribute_string( 'text' ); ?>><?php echo wp_kses_post( $settings['text'] ); ?></span> | |
| 685 | + <span <?php $instance->print_render_attribute_string( 'text' ); ?>><?php $this->print_unescaped_setting( 'text' ); ?></span> | |
| 689 | 686 | <?php endif; ?> |
| 690 | 687 | </span> |
| 691 | 688 | <?php |
| 692 | 689 | } |