| @@ -93,26 +93,8 @@ | ||
| 93 | 93 | return false; |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | /** |
| 97 | - * Get style dependencies. | |
| 98 | - * | |
| 99 | - * Retrieve the list of style dependencies the widget requires. | |
| 100 | - * | |
| 101 | - * @since 3.24.0 | |
| 102 | - * @access public | |
| 103 | - * | |
| 104 | - * @return array Widget style dependencies. | |
| 105 | - */ | |
| 106 | - public function get_style_depends(): array { | |
| 107 | - return [ 'widget-image' ]; | |
| 108 | - } | |
| 109 | - | |
| 110 | - public function has_widget_inner_wrapper(): bool { | |
| 111 | - return ! Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' ); | |
| 112 | - } | |
| 113 | - | |
| 114 | - /** | |
| 115 | 97 | * Register image widget controls. |
| 116 | 98 | * |
| 117 | 99 | * Adds different input fields to allow the user to change and customize the widget settings. |
| 118 | 100 | * |
| @@ -258,10 +240,10 @@ | ||
| 258 | 240 | [ |
| 259 | 241 | 'label' => esc_html__( 'Alignment', 'elementor' ), |
| 260 | 242 | 'type' => Controls_Manager::CHOOSE, |
| 261 | 243 | 'options' => [ |
| 262 | - 'start' => [ | |
| 263 | - 'title' => esc_html__( 'Start', 'elementor' ), | |
| 244 | + 'left' => [ | |
| 245 | + 'title' => esc_html__( 'Left', 'elementor' ), | |
| 264 | 246 | 'icon' => 'eicon-text-align-left', |
| 265 | 247 | ], |
| 266 | 248 | 'center' => [ |
| 267 | 249 | 'title' => esc_html__( 'Center', 'elementor' ), |
| @@ -266,18 +248,13 @@ | ||
| 266 | 248 | 'center' => [ |
| 267 | 249 | 'title' => esc_html__( 'Center', 'elementor' ), |
| 268 | 250 | 'icon' => 'eicon-text-align-center', |
| 269 | 251 | ], |
| 270 | - 'end' => [ | |
| 271 | - 'title' => esc_html__( 'End', 'elementor' ), | |
| 252 | + 'right' => [ | |
| 253 | + 'title' => esc_html__( 'Right', 'elementor' ), | |
| 272 | 254 | 'icon' => 'eicon-text-align-right', |
| 273 | 255 | ], |
| 274 | 256 | ], |
| 275 | - 'classes' => 'elementor-control-start-end', | |
| 276 | - 'selectors_dictionary' => [ | |
| 277 | - 'left' => is_rtl() ? 'end' : 'start', | |
| 278 | - 'right' => is_rtl() ? 'start' : 'end', | |
| 279 | - ], | |
| 280 | 257 | 'selectors' => [ |
| 281 | 258 | '{{WRAPPER}}' => 'text-align: {{VALUE}};', |
| 282 | 259 | ], |
| 283 | 260 | ] |
| @@ -581,10 +558,10 @@ | ||
| 581 | 558 | [ |
| 582 | 559 | 'label' => esc_html__( 'Alignment', 'elementor' ), |
| 583 | 560 | 'type' => Controls_Manager::CHOOSE, |
| 584 | 561 | 'options' => [ |
| 585 | - 'start' => [ | |
| 586 | - 'title' => esc_html__( 'Start', 'elementor' ), | |
| 562 | + 'left' => [ | |
| 563 | + 'title' => esc_html__( 'Left', 'elementor' ), | |
| 587 | 564 | 'icon' => 'eicon-text-align-left', |
| 588 | 565 | ], |
| 589 | 566 | 'center' => [ |
| 590 | 567 | 'title' => esc_html__( 'Center', 'elementor' ), |
| @@ -589,10 +566,10 @@ | ||
| 589 | 566 | 'center' => [ |
| 590 | 567 | 'title' => esc_html__( 'Center', 'elementor' ), |
| 591 | 568 | 'icon' => 'eicon-text-align-center', |
| 592 | 569 | ], |
| 593 | - 'end' => [ | |
| 594 | - 'title' => esc_html__( 'End', 'elementor' ), | |
| 570 | + 'right' => [ | |
| 571 | + 'title' => esc_html__( 'Right', 'elementor' ), | |
| 595 | 572 | 'icon' => 'eicon-text-align-right', |
| 596 | 573 | ], |
| 597 | 574 | 'justify' => [ |
| 598 | 575 | 'title' => esc_html__( 'Justified', 'elementor' ), |
| @@ -598,13 +575,8 @@ | ||
| 598 | 575 | 'title' => esc_html__( 'Justified', 'elementor' ), |
| 599 | 576 | 'icon' => 'eicon-text-align-justify', |
| 600 | 577 | ], |
| 601 | 578 | ], |
| 602 | - 'classes' => 'elementor-control-start-end', | |
| 603 | - 'selectors_dictionary' => [ | |
| 604 | - 'left' => is_rtl() ? 'end' : 'start', | |
| 605 | - 'right' => is_rtl() ? 'start' : 'end', | |
| 606 | - ], | |
| 607 | 579 | 'default' => '', |
| 608 | 580 | 'selectors' => [ |
| 609 | 581 | '{{WRAPPER}} .widget-image-caption' => 'text-align: {{VALUE}};', |
| 610 | 582 | ], |
| @@ -675,9 +647,9 @@ | ||
| 675 | 647 | 'max' => 10, |
| 676 | 648 | ], |
| 677 | 649 | ], |
| 678 | 650 | 'selectors' => [ |
| 679 | - '{{WRAPPER}} .widget-image-caption' => 'margin-block-start: {{SIZE}}{{UNIT}};', | |
| 651 | + '{{WRAPPER}} .widget-image-caption' => 'margin-top: {{SIZE}}{{UNIT}};', | |
| 680 | 652 | ], |
| 681 | 653 | ] |
| 682 | 654 | ); |
| 683 | 655 | |
| @@ -702,9 +674,9 @@ | ||
| 702 | 674 | * Get the caption for current widget. |
| 703 | 675 | * |
| 704 | 676 | * @access private |
| 705 | 677 | * @since 2.3.0 |
| 706 | - * @param array $settings | |
| 678 | + * @param $settings | |
| 707 | 679 | * |
| 708 | 680 | * @return string |
| 709 | 681 | */ |
| 710 | 682 | private function get_caption( $settings ) { |
| @@ -773,64 +745,8 @@ | ||
| 773 | 745 | <?php endif; ?> |
| 774 | 746 | <?php |
| 775 | 747 | } |
| 776 | 748 | |
| 777 | - public function render_markdown(): string { | |
| 778 | - $settings = $this->get_settings_for_display(); | |
| 779 | - | |
| 780 | - if ( empty( $settings['image']['url'] ) ) { | |
| 781 | - return ''; | |
| 782 | - } | |
| 783 | - | |
| 784 | - $url = esc_url( $settings['image']['url'] ); | |
| 785 | - $alt = $this->get_image_alt_text( $settings ); | |
| 786 | - $image_md = ''; | |
| 787 | - | |
| 788 | - $link = $this->get_link_url( $settings ); | |
| 789 | - | |
| 790 | - if ( ! empty( $link['url'] ) && $link['url'] !== $url ) { | |
| 791 | - $image_md = '[' . $image_md . '](' . esc_url( $link['url'] ) . ')'; | |
| 792 | - } | |
| 793 | - | |
| 794 | - $caption = $this->get_visible_caption( $settings ); | |
| 795 | - | |
| 796 | - if ( ! empty( $caption ) ) { | |
| 797 | - $image_md .= "\n" . $caption; | |
| 798 | - } | |
| 799 | - | |
| 800 | - return $image_md; | |
| 801 | - } | |
| 802 | - | |
| 803 | - private function get_image_alt_text( array $settings ): string { | |
| 804 | - if ( empty( $settings['image']['id'] ) ) { | |
| 805 | - return ''; | |
| 806 | - } | |
| 807 | - | |
| 808 | - $attachment_id = $settings['image']['id']; | |
| 809 | - | |
| 810 | - $alt = get_post_meta( $attachment_id, '_wp_attachment_image_alt', true ); | |
| 811 | - | |
| 812 | - if ( ! empty( $alt ) ) { | |
| 813 | - return $alt; | |
| 814 | - } | |
| 815 | - | |
| 816 | - $attachment = get_post( $attachment_id ); | |
| 817 | - | |
| 818 | - if ( ! $attachment ) { | |
| 819 | - return ''; | |
| 820 | - } | |
| 821 | - | |
| 822 | - return $attachment->post_title ?? ''; | |
| 823 | - } | |
| 824 | - | |
| 825 | - private function get_visible_caption( array $settings ): string { | |
| 826 | - if ( ! $this->has_caption( $settings ) ) { | |
| 827 | - return ''; | |
| 828 | - } | |
| 829 | - | |
| 830 | - return Utils::html_to_plain_text( $this->get_caption( $settings ) ); | |
| 831 | - } | |
| 832 | - | |
| 833 | 749 | /** |
| 834 | 750 | * Render image widget output in the editor. |
| 835 | 751 | * |
| 836 | 752 | * Written as a Backbone JavaScript template and used to generate the live preview. |
| @@ -887,9 +803,9 @@ | ||
| 887 | 803 | |
| 888 | 804 | var link_url; |
| 889 | 805 | |
| 890 | 806 | if ( 'custom' === settings.link_to ) { |
| 891 | - link_url = settings.link?.url; | |
| 807 | + link_url = settings.link.url; | |
| 892 | 808 | } |
| 893 | 809 | |
| 894 | 810 | if ( 'file' === settings.link_to ) { |
| 895 | 811 | link_url = settings.image.url; |
| @@ -905,9 +821,9 @@ | ||
| 905 | 821 | #><figure class="wp-caption"><# |
| 906 | 822 | } |
| 907 | 823 | |
| 908 | 824 | if ( link_url ) { |
| 909 | - #><a class="elementor-clickable" data-elementor-open-lightbox="{{ settings.open_lightbox }}" href="{{ elementor.helpers.sanitizeUrl( link_url ) }}"><# | |
| 825 | + #><a class="elementor-clickable" data-elementor-open-lightbox="{{ settings.open_lightbox }}" href="{{ link_url }}"><# | |
| 910 | 826 | } |
| 911 | 827 | #><img src="{{ image_url }}" class="{{ imgClass }}" /><# |
| 912 | 828 | |
| 913 | 829 | if ( link_url ) { |