| @@ -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', |
| @@ -759,13 +754,10 @@ | ||
| 759 | 754 | */ |
| 760 | 755 | protected function render() { |
| 761 | 756 | $settings = $this->get_settings_for_display(); |
| 762 | 757 | |
| 763 | - $description_text = wp_kses_post( $settings['description_text'] ); | |
| 764 | - $title_text = wp_kses_post( $settings['title_text'] ); | |
| 765 | - | |
| 766 | 758 | $has_image = ! empty( $settings['image']['url'] ); |
| 767 | - $has_content = ! Utils::is_empty( $title_text ) || ! Utils::is_empty( $description_text ); | |
| 759 | + $has_content = ! Utils::is_empty( $settings['title_text'] ) || ! Utils::is_empty( $settings['description_text'] ); | |
| 768 | 760 | |
| 769 | 761 | if ( ! $has_image && ! $has_content ) { |
| 770 | 762 | return; |
| 771 | 763 | } |
| @@ -789,27 +781,28 @@ | ||
| 789 | 781 | |
| 790 | 782 | if ( $has_content ) { |
| 791 | 783 | $html .= '<div class="elementor-image-box-content">'; |
| 792 | 784 | |
| 793 | - if ( ! Utils::is_empty( $title_text ) ) { | |
| 794 | - $title_html = $title_text; | |
| 785 | + if ( ! Utils::is_empty( $settings['title_text'] ) ) { | |
| 795 | 786 | $this->add_render_attribute( 'title_text', 'class', 'elementor-image-box-title' ); |
| 796 | 787 | |
| 797 | 788 | $this->add_inline_editing_attributes( 'title_text', 'none' ); |
| 798 | 789 | |
| 790 | + $title_html = $settings['title_text']; | |
| 791 | + | |
| 799 | 792 | if ( ! empty( $settings['link']['url'] ) ) { |
| 800 | - $title_html = '<a ' . $this->get_render_attribute_string( 'link' ) . '>' . $title_text . '</a>'; | |
| 793 | + $title_html = '<a ' . $this->get_render_attribute_string( 'link' ) . '>' . $title_html . '</a>'; | |
| 801 | 794 | } |
| 802 | 795 | |
| 803 | 796 | $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 | 797 | } |
| 805 | 798 | |
| 806 | - if ( ! Utils::is_empty( $description_text ) ) { | |
| 799 | + if ( ! Utils::is_empty( $settings['description_text'] ) ) { | |
| 807 | 800 | $this->add_render_attribute( 'description_text', 'class', 'elementor-image-box-description' ); |
| 808 | 801 | |
| 809 | 802 | $this->add_inline_editing_attributes( 'description_text' ); |
| 810 | 803 | |
| 811 | - $html .= sprintf( '<p %1$s>%2$s</p>', $this->get_render_attribute_string( 'description_text' ), $description_text ); | |
| 804 | + $html .= sprintf( '<p %1$s>%2$s</p>', $this->get_render_attribute_string( 'description_text' ), $settings['description_text'] ); | |
| 812 | 805 | } |
| 813 | 806 | |
| 814 | 807 | $html .= '</div>'; |
| 815 | 808 | } |
| @@ -829,13 +822,10 @@ | ||
| 829 | 822 | */ |
| 830 | 823 | protected function content_template() { |
| 831 | 824 | ?> |
| 832 | 825 | <# |
| 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 | 826 | var hasImage = !! settings.image.url; |
| 837 | - var hasContent = !! ( titleText || descriptionText ); | |
| 827 | + var hasContent = !! ( settings.title_text || settings.description_text ); | |
| 838 | 828 | |
| 839 | 829 | if ( ! hasImage && ! hasContent ) { |
| 840 | 830 | return; |
| 841 | 831 | } |
| @@ -854,10 +844,10 @@ | ||
| 854 | 844 | var image_url = elementor.imagesManager.getImageUrl( image ); |
| 855 | 845 | |
| 856 | 846 | var imageHtml = '<img src="' + _.escape( image_url ) + '" class="elementor-animation-' + _.escape( settings.hover_animation ) + '" />'; |
| 857 | 847 | |
| 858 | - if ( settings.link?.url ) { | |
| 859 | - imageHtml = '<a href="' + elementor.helpers.sanitizeUrl( settings.link?.url ) + '" tabindex="-1">' + imageHtml + '</a>'; | |
| 848 | + if ( settings.link.url ) { | |
| 849 | + imageHtml = '<a href="' + elementor.helpers.sanitizeUrl( settings.link.url ) + '" tabindex="-1">' + imageHtml + '</a>'; | |
| 860 | 850 | } |
| 861 | 851 | |
| 862 | 852 | html += '<figure class="elementor-image-box-img">' + imageHtml + '</figure>'; |
| 863 | 853 | } |
| @@ -864,13 +854,14 @@ | ||
| 864 | 854 | |
| 865 | 855 | if ( hasContent ) { |
| 866 | 856 | html += '<div class="elementor-image-box-content">'; |
| 867 | 857 | |
| 868 | - if ( titleText ) { | |
| 869 | - var titleSizeTag = elementor.helpers.validateHTMLTag( settings.title_size ); | |
| 858 | + if ( settings.title_text ) { | |
| 859 | + var title_html = elementor.helpers.sanitize( settings.title_text ), | |
| 860 | + titleSizeTag = elementor.helpers.validateHTMLTag( settings.title_size ); | |
| 870 | 861 | |
| 871 | - if ( settings.link?.url ) { | |
| 872 | - title_html = '<a href="' + elementor.helpers.sanitizeUrl( settings.link?.url ) + '">' + titleText + '</a>'; | |
| 862 | + if ( settings.link.url ) { | |
| 863 | + title_html = '<a href="' + elementor.helpers.sanitizeUrl( settings.link.url ) + '">' + title_html + '</a>'; | |
| 873 | 864 | } |
| 874 | 865 | |
| 875 | 866 | view.addRenderAttribute( 'title_text', 'class', 'elementor-image-box-title' ); |
| 876 | 867 | |
| @@ -875,17 +866,17 @@ | ||
| 875 | 866 | view.addRenderAttribute( 'title_text', 'class', 'elementor-image-box-title' ); |
| 876 | 867 | |
| 877 | 868 | view.addInlineEditingAttributes( 'title_text', 'none' ); |
| 878 | 869 | |
| 879 | - html += '<' + titleSizeTag + ' ' + view.getRenderAttributeString( 'title_text' ) + '>' + titleText + '</' + titleSizeTag + '>'; | |
| 870 | + html += '<' + titleSizeTag + ' ' + view.getRenderAttributeString( 'title_text' ) + '>' + title_html + '</' + titleSizeTag + '>'; | |
| 880 | 871 | } |
| 881 | 872 | |
| 882 | - if ( descriptionText ) { | |
| 873 | + if ( settings.description_text ) { | |
| 883 | 874 | view.addRenderAttribute( 'description_text', 'class', 'elementor-image-box-description' ); |
| 884 | 875 | |
| 885 | 876 | view.addInlineEditingAttributes( 'description_text' ); |
| 886 | 877 | |
| 887 | - html += '<p ' + view.getRenderAttributeString( 'description_text' ) + '>' + descriptionText + '</p>'; | |
| 878 | + html += '<p ' + view.getRenderAttributeString( 'description_text' ) + '>' + settings.description_text + '</p>'; | |
| 888 | 879 | } |
| 889 | 880 | |
| 890 | 881 | html += '</div>'; |
| 891 | 882 | } |
| @@ -894,31 +885,6 @@ | ||
| 894 | 885 | |
| 895 | 886 | print( html ); |
| 896 | 887 | #> |
| 897 | 888 | <?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 | 889 | } |
| 924 | 890 | } |