| @@ -267,10 +267,10 @@ | ||
| 267 | 267 | [ |
| 268 | 268 | 'label' => esc_html__( 'Alignment', 'elementor' ), |
| 269 | 269 | 'type' => Controls_Manager::CHOOSE, |
| 270 | 270 | 'options' => [ |
| 271 | - 'start' => [ | |
| 272 | - 'title' => esc_html__( 'Start', 'elementor' ), | |
| 271 | + 'left' => [ | |
| 272 | + 'title' => esc_html__( 'Left', 'elementor' ), | |
| 273 | 273 | 'icon' => 'eicon-text-align-left', |
| 274 | 274 | ], |
| 275 | 275 | 'center' => [ |
| 276 | 276 | 'title' => esc_html__( 'Center', 'elementor' ), |
| @@ -275,10 +275,10 @@ | ||
| 275 | 275 | 'center' => [ |
| 276 | 276 | 'title' => esc_html__( 'Center', 'elementor' ), |
| 277 | 277 | 'icon' => 'eicon-text-align-center', |
| 278 | 278 | ], |
| 279 | - 'end' => [ | |
| 280 | - 'title' => esc_html__( 'End', 'elementor' ), | |
| 279 | + 'right' => [ | |
| 280 | + 'title' => esc_html__( 'Right', 'elementor' ), | |
| 281 | 281 | 'icon' => 'eicon-text-align-right', |
| 282 | 282 | ], |
| 283 | 283 | 'justify' => [ |
| 284 | 284 | 'title' => esc_html__( 'Justified', 'elementor' ), |
| @@ -284,13 +284,8 @@ | ||
| 284 | 284 | 'title' => esc_html__( 'Justified', 'elementor' ), |
| 285 | 285 | 'icon' => 'eicon-text-align-justify', |
| 286 | 286 | ], |
| 287 | 287 | ], |
| 288 | - 'classes' => 'elementor-control-start-end', | |
| 289 | - 'selectors_dictionary' => [ | |
| 290 | - 'left' => is_rtl() ? 'end' : 'start', | |
| 291 | - 'right' => is_rtl() ? 'start' : 'end', | |
| 292 | - ], | |
| 293 | 288 | 'selectors' => [ |
| 294 | 289 | '{{WRAPPER}} .elementor-image-box-wrapper' => 'text-align: {{VALUE}};', |
| 295 | 290 | ], |
| 296 | 291 | 'separator' => 'after', |
| @@ -388,68 +383,8 @@ | ||
| 388 | 383 | ], |
| 389 | 384 | ] |
| 390 | 385 | ); |
| 391 | 386 | |
| 392 | - $this->add_responsive_control( | |
| 393 | - 'image_height', | |
| 394 | - [ | |
| 395 | - 'label' => esc_html__( 'Height', 'elementor' ), | |
| 396 | - 'type' => Controls_Manager::SLIDER, | |
| 397 | - 'size_units' => [ 'px', '%', 'em', 'rem', 'vh', 'custom' ], | |
| 398 | - 'selectors' => [ | |
| 399 | - '{{WRAPPER}} .elementor-image-box-img img' => 'height: {{SIZE}}{{UNIT}};', | |
| 400 | - ], | |
| 401 | - ] | |
| 402 | - ); | |
| 403 | - | |
| 404 | - $this->add_responsive_control( | |
| 405 | - 'image_object_fit', | |
| 406 | - [ | |
| 407 | - 'label' => esc_html__( 'Object Fit', 'elementor' ), | |
| 408 | - 'type' => Controls_Manager::SELECT, | |
| 409 | - 'options' => [ | |
| 410 | - '' => esc_html__( 'Default', 'elementor' ), | |
| 411 | - 'fill' => esc_html__( 'Fill', 'elementor' ), | |
| 412 | - 'cover' => esc_html__( 'Cover', 'elementor' ), | |
| 413 | - 'contain' => esc_html__( 'Contain', 'elementor' ), | |
| 414 | - 'scale-down' => esc_html__( 'Scale Down', 'elementor' ), | |
| 415 | - ], | |
| 416 | - 'condition' => [ | |
| 417 | - 'image_height[size]!' => '', | |
| 418 | - ], | |
| 419 | - 'selectors' => [ | |
| 420 | - '{{WRAPPER}} .elementor-image-box-img img' => 'object-fit: {{VALUE}};', | |
| 421 | - ], | |
| 422 | - ] | |
| 423 | - ); | |
| 424 | - | |
| 425 | - $this->add_responsive_control( | |
| 426 | - 'image_object_position', | |
| 427 | - [ | |
| 428 | - 'label' => esc_html__( 'Object Position', 'elementor' ), | |
| 429 | - 'type' => Controls_Manager::SELECT, | |
| 430 | - 'options' => [ | |
| 431 | - 'center center' => esc_html__( 'Center Center', 'elementor' ), | |
| 432 | - 'center left' => esc_html__( 'Center Left', 'elementor' ), | |
| 433 | - 'center right' => esc_html__( 'Center Right', 'elementor' ), | |
| 434 | - 'top center' => esc_html__( 'Top Center', 'elementor' ), | |
| 435 | - 'top left' => esc_html__( 'Top Left', 'elementor' ), | |
| 436 | - 'top right' => esc_html__( 'Top Right', 'elementor' ), | |
| 437 | - 'bottom center' => esc_html__( 'Bottom Center', 'elementor' ), | |
| 438 | - 'bottom left' => esc_html__( 'Bottom Left', 'elementor' ), | |
| 439 | - 'bottom right' => esc_html__( 'Bottom Right', 'elementor' ), | |
| 440 | - ], | |
| 441 | - 'default' => 'center center', | |
| 442 | - 'selectors' => [ | |
| 443 | - '{{WRAPPER}} .elementor-image-box-img img' => 'object-position: {{VALUE}};', | |
| 444 | - ], | |
| 445 | - 'condition' => [ | |
| 446 | - 'image_height[size]!' => '', | |
| 447 | - 'image_object_fit' => [ 'cover', 'contain', 'scale-down' ], | |
| 448 | - ], | |
| 449 | - ] | |
| 450 | - ); | |
| 451 | - | |
| 452 | 387 | $this->add_group_control( |
| 453 | 388 | Group_Control_Border::get_type(), |
| 454 | 389 | [ |
| 455 | 390 | 'name' => 'image_border', |
| @@ -463,8 +398,9 @@ | ||
| 463 | 398 | [ |
| 464 | 399 | 'label' => esc_html__( 'Border Radius', 'elementor' ), |
| 465 | 400 | 'type' => Controls_Manager::SLIDER, |
| 466 | 401 | 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ], |
| 402 | + 'separator' => 'after', | |
| 467 | 403 | 'selectors' => [ |
| 468 | 404 | '{{WRAPPER}} .elementor-image-box-img img' => 'border-radius: {{SIZE}}{{UNIT}};', |
| 469 | 405 | ], |
| 470 | 406 | ] |
| @@ -469,24 +405,8 @@ | ||
| 469 | 405 | ], |
| 470 | 406 | ] |
| 471 | 407 | ); |
| 472 | 408 | |
| 473 | - $this->add_group_control( | |
| 474 | - Group_Control_Box_Shadow::get_type(), | |
| 475 | - [ | |
| 476 | - 'name' => 'image_box_shadow', | |
| 477 | - 'selector' => '{{WRAPPER}} .elementor-image-box-img img', | |
| 478 | - ] | |
| 479 | - ); | |
| 480 | - | |
| 481 | - $this->add_control( | |
| 482 | - 'separator_panel_style', | |
| 483 | - [ | |
| 484 | - 'type' => Controls_Manager::DIVIDER, | |
| 485 | - 'style' => 'thick', | |
| 486 | - ] | |
| 487 | - ); | |
| 488 | - | |
| 489 | 409 | $this->start_controls_tabs( 'image_effects' ); |
| 490 | 410 | |
| 491 | 411 | $this->start_controls_tab( |
| 492 | 412 | 'normal', |
| @@ -759,13 +679,10 @@ | ||
| 759 | 679 | */ |
| 760 | 680 | protected function render() { |
| 761 | 681 | $settings = $this->get_settings_for_display(); |
| 762 | 682 | |
| 763 | - $description_text = wp_kses_post( $settings['description_text'] ); | |
| 764 | - $title_text = wp_kses_post( $settings['title_text'] ); | |
| 765 | - | |
| 766 | 683 | $has_image = ! empty( $settings['image']['url'] ); |
| 767 | - $has_content = ! Utils::is_empty( $title_text ) || ! Utils::is_empty( $description_text ); | |
| 684 | + $has_content = ! Utils::is_empty( $settings['title_text'] ) || ! Utils::is_empty( $settings['description_text'] ); | |
| 768 | 685 | |
| 769 | 686 | if ( ! $has_image && ! $has_content ) { |
| 770 | 687 | return; |
| 771 | 688 | } |
| @@ -789,27 +706,28 @@ | ||
| 789 | 706 | |
| 790 | 707 | if ( $has_content ) { |
| 791 | 708 | $html .= '<div class="elementor-image-box-content">'; |
| 792 | 709 | |
| 793 | - if ( ! Utils::is_empty( $title_text ) ) { | |
| 794 | - $title_html = $title_text; | |
| 710 | + if ( ! Utils::is_empty( $settings['title_text'] ) ) { | |
| 795 | 711 | $this->add_render_attribute( 'title_text', 'class', 'elementor-image-box-title' ); |
| 796 | 712 | |
| 797 | 713 | $this->add_inline_editing_attributes( 'title_text', 'none' ); |
| 798 | 714 | |
| 715 | + $title_html = $settings['title_text']; | |
| 716 | + | |
| 799 | 717 | if ( ! empty( $settings['link']['url'] ) ) { |
| 800 | - $title_html = '<a ' . $this->get_render_attribute_string( 'link' ) . '>' . $title_text . '</a>'; | |
| 718 | + $title_html = '<a ' . $this->get_render_attribute_string( 'link' ) . '>' . $title_html . '</a>'; | |
| 801 | 719 | } |
| 802 | 720 | |
| 803 | 721 | $html .= sprintf( '<%1$s %2$s>%3$s</%1$s>', Utils::validate_html_tag( $settings['title_size'] ), $this->get_render_attribute_string( 'title_text' ), $title_html ); |
| 804 | 722 | } |
| 805 | 723 | |
| 806 | - if ( ! Utils::is_empty( $description_text ) ) { | |
| 724 | + if ( ! Utils::is_empty( $settings['description_text'] ) ) { | |
| 807 | 725 | $this->add_render_attribute( 'description_text', 'class', 'elementor-image-box-description' ); |
| 808 | 726 | |
| 809 | 727 | $this->add_inline_editing_attributes( 'description_text' ); |
| 810 | 728 | |
| 811 | - $html .= sprintf( '<p %1$s>%2$s</p>', $this->get_render_attribute_string( 'description_text' ), $description_text ); | |
| 729 | + $html .= sprintf( '<p %1$s>%2$s</p>', $this->get_render_attribute_string( 'description_text' ), $settings['description_text'] ); | |
| 812 | 730 | } |
| 813 | 731 | |
| 814 | 732 | $html .= '</div>'; |
| 815 | 733 | } |
| @@ -829,13 +747,10 @@ | ||
| 829 | 747 | */ |
| 830 | 748 | protected function content_template() { |
| 831 | 749 | ?> |
| 832 | 750 | <# |
| 833 | - const titleText = elementor.helpers.sanitize( settings.title_text, { ALLOW_DATA_ATTR: false } ) | |
| 834 | - const descriptionText = elementor.helpers.sanitize( settings.description_text, { ALLOW_DATA_ATTR: false } ) | |
| 835 | - | |
| 836 | 751 | var hasImage = !! settings.image.url; |
| 837 | - var hasContent = !! ( titleText || descriptionText ); | |
| 752 | + var hasContent = !! ( settings.title_text || settings.description_text ); | |
| 838 | 753 | |
| 839 | 754 | if ( ! hasImage && ! hasContent ) { |
| 840 | 755 | return; |
| 841 | 756 | } |
| @@ -854,10 +769,10 @@ | ||
| 854 | 769 | var image_url = elementor.imagesManager.getImageUrl( image ); |
| 855 | 770 | |
| 856 | 771 | var imageHtml = '<img src="' + _.escape( image_url ) + '" class="elementor-animation-' + _.escape( settings.hover_animation ) + '" />'; |
| 857 | 772 | |
| 858 | - if ( settings.link?.url ) { | |
| 859 | - imageHtml = '<a href="' + elementor.helpers.sanitizeUrl( settings.link?.url ) + '" tabindex="-1">' + imageHtml + '</a>'; | |
| 773 | + if ( settings.link.url ) { | |
| 774 | + imageHtml = '<a href="' + elementor.helpers.sanitizeUrl( settings.link.url ) + '" tabindex="-1">' + imageHtml + '</a>'; | |
| 860 | 775 | } |
| 861 | 776 | |
| 862 | 777 | html += '<figure class="elementor-image-box-img">' + imageHtml + '</figure>'; |
| 863 | 778 | } |
| @@ -864,13 +779,14 @@ | ||
| 864 | 779 | |
| 865 | 780 | if ( hasContent ) { |
| 866 | 781 | html += '<div class="elementor-image-box-content">'; |
| 867 | 782 | |
| 868 | - if ( titleText ) { | |
| 869 | - var titleSizeTag = elementor.helpers.validateHTMLTag( settings.title_size ); | |
| 783 | + if ( settings.title_text ) { | |
| 784 | + var title_html = elementor.helpers.sanitize( settings.title_text ), | |
| 785 | + titleSizeTag = elementor.helpers.validateHTMLTag( settings.title_size ); | |
| 870 | 786 | |
| 871 | - if ( settings.link?.url ) { | |
| 872 | - title_html = '<a href="' + elementor.helpers.sanitizeUrl( settings.link?.url ) + '">' + titleText + '</a>'; | |
| 787 | + if ( settings.link.url ) { | |
| 788 | + title_html = '<a href="' + elementor.helpers.sanitizeUrl( settings.link.url ) + '">' + title_html + '</a>'; | |
| 873 | 789 | } |
| 874 | 790 | |
| 875 | 791 | view.addRenderAttribute( 'title_text', 'class', 'elementor-image-box-title' ); |
| 876 | 792 | |
| @@ -875,17 +791,17 @@ | ||
| 875 | 791 | view.addRenderAttribute( 'title_text', 'class', 'elementor-image-box-title' ); |
| 876 | 792 | |
| 877 | 793 | view.addInlineEditingAttributes( 'title_text', 'none' ); |
| 878 | 794 | |
| 879 | - html += '<' + titleSizeTag + ' ' + view.getRenderAttributeString( 'title_text' ) + '>' + titleText + '</' + titleSizeTag + '>'; | |
| 795 | + html += '<' + titleSizeTag + ' ' + view.getRenderAttributeString( 'title_text' ) + '>' + title_html + '</' + titleSizeTag + '>'; | |
| 880 | 796 | } |
| 881 | 797 | |
| 882 | - if ( descriptionText ) { | |
| 798 | + if ( settings.description_text ) { | |
| 883 | 799 | view.addRenderAttribute( 'description_text', 'class', 'elementor-image-box-description' ); |
| 884 | 800 | |
| 885 | 801 | view.addInlineEditingAttributes( 'description_text' ); |
| 886 | 802 | |
| 887 | - html += '<p ' + view.getRenderAttributeString( 'description_text' ) + '>' + descriptionText + '</p>'; | |
| 803 | + html += '<p ' + view.getRenderAttributeString( 'description_text' ) + '>' + settings.description_text + '</p>'; | |
| 888 | 804 | } |
| 889 | 805 | |
| 890 | 806 | html += '</div>'; |
| 891 | 807 | } |
| @@ -894,31 +810,6 @@ | ||
| 894 | 810 | |
| 895 | 811 | print( html ); |
| 896 | 812 | #> |
| 897 | 813 | <?php |
| 898 | - } | |
| 899 | - | |
| 900 | - public function render_markdown(): string { | |
| 901 | - $settings = $this->get_settings_for_display(); | |
| 902 | - $title = Utils::html_to_plain_text( $settings['title_text'] ?? '' ); | |
| 903 | - $description = Utils::html_to_plain_text( $settings['description_text'] ?? '' ); | |
| 904 | - $image_url = $settings['image']['url'] ?? ''; | |
| 905 | - if ( empty( $title ) && empty( $description ) && empty( $image_url ) ) { | |
| 906 | - return ''; | |
| 907 | - } | |
| 908 | - $parts = []; | |
| 909 | - if ( ! empty( $image_url ) ) { | |
| 910 | - $parts[] = ' . ')'; | |
| 911 | - } | |
| 912 | - if ( ! empty( $title ) ) { | |
| 913 | - if ( ! empty( $settings['link']['url'] ) ) { | |
| 914 | - $parts[] = '### [' . $title . '](' . esc_url( $settings['link']['url'] ) . ')'; | |
| 915 | - } else { | |
| 916 | - $parts[] = '### ' . $title; | |
| 917 | - } | |
| 918 | - } | |
| 919 | - if ( ! empty( $description ) ) { | |
| 920 | - $parts[] = $description; | |
| 921 | - } | |
| 922 | - return implode( "\n\n", $parts ); | |
| 923 | 814 | } |
| 924 | 815 | } |