PluginProbe
Elementor Website Builder – more than just a page builder / 3.20.0-dev3
Elementor Website Builder – more than just a page builder v3.20.0-dev3
4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 4.0.7 All 451 releases
← All changes | includes/widgets/image.php +13 -102 4.2.13.20.0-dev3 View file →
@@ -88,31 +88,9 @@
88 88 public function get_keywords() {
89 89 return [ 'image', 'photo', 'visual' ];
90 90 }
91 91
92 - protected function is_dynamic_content(): bool {
93 - return false;
94 - }
95 -
96 92 /**
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 93 * Register image widget controls.
116 94 *
117 95 * Adds different input fields to allow the user to change and customize the widget settings.
118 96 *
@@ -258,10 +236,10 @@
258 236 [
259 237 'label' => esc_html__( 'Alignment', 'elementor' ),
260 238 'type' => Controls_Manager::CHOOSE,
261 239 'options' => [
262 - 'start' => [
263 - 'title' => esc_html__( 'Start', 'elementor' ),
240 + 'left' => [
241 + 'title' => esc_html__( 'Left', 'elementor' ),
264 242 'icon' => 'eicon-text-align-left',
265 243 ],
266 244 'center' => [
267 245 'title' => esc_html__( 'Center', 'elementor' ),
@@ -266,18 +244,13 @@
266 244 'center' => [
267 245 'title' => esc_html__( 'Center', 'elementor' ),
268 246 'icon' => 'eicon-text-align-center',
269 247 ],
270 - 'end' => [
271 - 'title' => esc_html__( 'End', 'elementor' ),
248 + 'right' => [
249 + 'title' => esc_html__( 'Right', 'elementor' ),
272 250 'icon' => 'eicon-text-align-right',
273 251 ],
274 252 ],
275 - 'classes' => 'elementor-control-start-end',
276 - 'selectors_dictionary' => [
277 - 'left' => is_rtl() ? 'end' : 'start',
278 - 'right' => is_rtl() ? 'start' : 'end',
279 - ],
280 253 'selectors' => [
281 254 '{{WRAPPER}}' => 'text-align: {{VALUE}};',
282 255 ],
283 256 ]
@@ -387,9 +360,8 @@
387 360 '' => esc_html__( 'Default', 'elementor' ),
388 361 'fill' => esc_html__( 'Fill', 'elementor' ),
389 362 'cover' => esc_html__( 'Cover', 'elementor' ),
390 363 'contain' => esc_html__( 'Contain', 'elementor' ),
391 - 'scale-down' => esc_html__( 'Scale Down', 'elementor' ),
392 364 ],
393 365 'default' => '',
394 366 'selectors' => [
395 367 '{{WRAPPER}} img' => 'object-fit: {{VALUE}};',
@@ -418,9 +390,9 @@
418 390 '{{WRAPPER}} img' => 'object-position: {{VALUE}};',
419 391 ],
420 392 'condition' => [
421 393 'height[size]!' => '',
422 - 'object-fit' => [ 'cover', 'contain', 'scale-down' ],
394 + 'object-fit' => 'cover',
423 395 ],
424 396 ]
425 397 );
426 398
@@ -581,10 +553,10 @@
581 553 [
582 554 'label' => esc_html__( 'Alignment', 'elementor' ),
583 555 'type' => Controls_Manager::CHOOSE,
584 556 'options' => [
585 - 'start' => [
586 - 'title' => esc_html__( 'Start', 'elementor' ),
557 + 'left' => [
558 + 'title' => esc_html__( 'Left', 'elementor' ),
587 559 'icon' => 'eicon-text-align-left',
588 560 ],
589 561 'center' => [
590 562 'title' => esc_html__( 'Center', 'elementor' ),
@@ -589,10 +561,10 @@
589 561 'center' => [
590 562 'title' => esc_html__( 'Center', 'elementor' ),
591 563 'icon' => 'eicon-text-align-center',
592 564 ],
593 - 'end' => [
594 - 'title' => esc_html__( 'End', 'elementor' ),
565 + 'right' => [
566 + 'title' => esc_html__( 'Right', 'elementor' ),
595 567 'icon' => 'eicon-text-align-right',
596 568 ],
597 569 'justify' => [
598 570 'title' => esc_html__( 'Justified', 'elementor' ),
@@ -598,13 +570,8 @@
598 570 'title' => esc_html__( 'Justified', 'elementor' ),
599 571 'icon' => 'eicon-text-align-justify',
600 572 ],
601 573 ],
602 - 'classes' => 'elementor-control-start-end',
603 - 'selectors_dictionary' => [
604 - 'left' => is_rtl() ? 'end' : 'start',
605 - 'right' => is_rtl() ? 'start' : 'end',
606 - ],
607 574 'default' => '',
608 575 'selectors' => [
609 576 '{{WRAPPER}} .widget-image-caption' => 'text-align: {{VALUE}};',
610 577 ],
@@ -675,9 +642,9 @@
675 642 'max' => 10,
676 643 ],
677 644 ],
678 645 'selectors' => [
679 - '{{WRAPPER}} .widget-image-caption' => 'margin-block-start: {{SIZE}}{{UNIT}};',
646 + '{{WRAPPER}} .widget-image-caption' => 'margin-top: {{SIZE}}{{UNIT}};',
680 647 ],
681 648 ]
682 649 );
683 650
@@ -702,9 +669,9 @@
702 669 * Get the caption for current widget.
703 670 *
704 671 * @access private
705 672 * @since 2.3.0
706 - * @param array $settings
673 + * @param $settings
707 674 *
708 675 * @return string
709 676 */
710 677 private function get_caption( $settings ) {
@@ -773,64 +740,8 @@
773 740 <?php endif; ?>
774 741 <?php
775 742 }
776 743
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 = '![' . $alt . '](' . $url . ')';
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 744 /**
834 745 * Render image widget output in the editor.
835 746 *
836 747 * Written as a Backbone JavaScript template and used to generate the live preview.
@@ -887,9 +798,9 @@
887 798
888 799 var link_url;
889 800
890 801 if ( 'custom' === settings.link_to ) {
891 - link_url = settings.link?.url;
802 + link_url = settings.link.url;
892 803 }
893 804
894 805 if ( 'file' === settings.link_to ) {
895 806 link_url = settings.image.url;
@@ -905,9 +816,9 @@
905 816 #><figure class="wp-caption"><#
906 817 }
907 818
908 819 if ( link_url ) {
909 - #><a class="elementor-clickable" data-elementor-open-lightbox="{{ settings.open_lightbox }}" href="{{ elementor.helpers.sanitizeUrl( link_url ) }}"><#
820 + #><a class="elementor-clickable" data-elementor-open-lightbox="{{ settings.open_lightbox }}" href="{{ link_url }}"><#
910 821 }
911 822 #><img src="{{ image_url }}" class="{{ imgClass }}" /><#
912 823
913 824 if ( link_url ) {