| @@ -106,12 +106,8 @@ | ||
| 106 | 106 | public function get_style_depends(): array { |
| 107 | 107 | return [ 'widget-image' ]; |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - public function has_widget_inner_wrapper(): bool { | |
| 111 | - return ! Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' ); | |
| 112 | - } | |
| 113 | - | |
| 114 | 110 | /** |
| 115 | 111 | * Register image widget controls. |
| 116 | 112 | * |
| 117 | 113 | * Adds different input fields to allow the user to change and customize the widget settings. |
| @@ -258,10 +254,10 @@ | ||
| 258 | 254 | [ |
| 259 | 255 | 'label' => esc_html__( 'Alignment', 'elementor' ), |
| 260 | 256 | 'type' => Controls_Manager::CHOOSE, |
| 261 | 257 | 'options' => [ |
| 262 | - 'start' => [ | |
| 263 | - 'title' => esc_html__( 'Start', 'elementor' ), | |
| 258 | + 'left' => [ | |
| 259 | + 'title' => esc_html__( 'Left', 'elementor' ), | |
| 264 | 260 | 'icon' => 'eicon-text-align-left', |
| 265 | 261 | ], |
| 266 | 262 | 'center' => [ |
| 267 | 263 | 'title' => esc_html__( 'Center', 'elementor' ), |
| @@ -266,18 +262,13 @@ | ||
| 266 | 262 | 'center' => [ |
| 267 | 263 | 'title' => esc_html__( 'Center', 'elementor' ), |
| 268 | 264 | 'icon' => 'eicon-text-align-center', |
| 269 | 265 | ], |
| 270 | - 'end' => [ | |
| 271 | - 'title' => esc_html__( 'End', 'elementor' ), | |
| 266 | + 'right' => [ | |
| 267 | + 'title' => esc_html__( 'Right', 'elementor' ), | |
| 272 | 268 | 'icon' => 'eicon-text-align-right', |
| 273 | 269 | ], |
| 274 | 270 | ], |
| 275 | - 'classes' => 'elementor-control-start-end', | |
| 276 | - 'selectors_dictionary' => [ | |
| 277 | - 'left' => is_rtl() ? 'end' : 'start', | |
| 278 | - 'right' => is_rtl() ? 'start' : 'end', | |
| 279 | - ], | |
| 280 | 271 | 'selectors' => [ |
| 281 | 272 | '{{WRAPPER}}' => 'text-align: {{VALUE}};', |
| 282 | 273 | ], |
| 283 | 274 | ] |
| @@ -581,10 +572,10 @@ | ||
| 581 | 572 | [ |
| 582 | 573 | 'label' => esc_html__( 'Alignment', 'elementor' ), |
| 583 | 574 | 'type' => Controls_Manager::CHOOSE, |
| 584 | 575 | 'options' => [ |
| 585 | - 'start' => [ | |
| 586 | - 'title' => esc_html__( 'Start', 'elementor' ), | |
| 576 | + 'left' => [ | |
| 577 | + 'title' => esc_html__( 'Left', 'elementor' ), | |
| 587 | 578 | 'icon' => 'eicon-text-align-left', |
| 588 | 579 | ], |
| 589 | 580 | 'center' => [ |
| 590 | 581 | 'title' => esc_html__( 'Center', 'elementor' ), |
| @@ -589,10 +580,10 @@ | ||
| 589 | 580 | 'center' => [ |
| 590 | 581 | 'title' => esc_html__( 'Center', 'elementor' ), |
| 591 | 582 | 'icon' => 'eicon-text-align-center', |
| 592 | 583 | ], |
| 593 | - 'end' => [ | |
| 594 | - 'title' => esc_html__( 'End', 'elementor' ), | |
| 584 | + 'right' => [ | |
| 585 | + 'title' => esc_html__( 'Right', 'elementor' ), | |
| 595 | 586 | 'icon' => 'eicon-text-align-right', |
| 596 | 587 | ], |
| 597 | 588 | 'justify' => [ |
| 598 | 589 | 'title' => esc_html__( 'Justified', 'elementor' ), |
| @@ -598,13 +589,8 @@ | ||
| 598 | 589 | 'title' => esc_html__( 'Justified', 'elementor' ), |
| 599 | 590 | 'icon' => 'eicon-text-align-justify', |
| 600 | 591 | ], |
| 601 | 592 | ], |
| 602 | - 'classes' => 'elementor-control-start-end', | |
| 603 | - 'selectors_dictionary' => [ | |
| 604 | - 'left' => is_rtl() ? 'end' : 'start', | |
| 605 | - 'right' => is_rtl() ? 'start' : 'end', | |
| 606 | - ], | |
| 607 | 593 | 'default' => '', |
| 608 | 594 | 'selectors' => [ |
| 609 | 595 | '{{WRAPPER}} .widget-image-caption' => 'text-align: {{VALUE}};', |
| 610 | 596 | ], |
| @@ -702,9 +688,9 @@ | ||
| 702 | 688 | * Get the caption for current widget. |
| 703 | 689 | * |
| 704 | 690 | * @access private |
| 705 | 691 | * @since 2.3.0 |
| 706 | - * @param array $settings | |
| 692 | + * @param $settings | |
| 707 | 693 | * |
| 708 | 694 | * @return string |
| 709 | 695 | */ |
| 710 | 696 | private function get_caption( $settings ) { |
| @@ -773,64 +759,8 @@ | ||
| 773 | 759 | <?php endif; ?> |
| 774 | 760 | <?php |
| 775 | 761 | } |
| 776 | 762 | |
| 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 | 763 | /** |
| 834 | 764 | * Render image widget output in the editor. |
| 835 | 765 | * |
| 836 | 766 | * Written as a Backbone JavaScript template and used to generate the live preview. |
| @@ -887,9 +817,9 @@ | ||
| 887 | 817 | |
| 888 | 818 | var link_url; |
| 889 | 819 | |
| 890 | 820 | if ( 'custom' === settings.link_to ) { |
| 891 | - link_url = settings.link?.url; | |
| 821 | + link_url = settings.link.url; | |
| 892 | 822 | } |
| 893 | 823 | |
| 894 | 824 | if ( 'file' === settings.link_to ) { |
| 895 | 825 | link_url = settings.image.url; |