PluginProbe
Elementor Website Builder – more than just a page builder / 3.19.4
Elementor Website Builder – more than just a page builder v3.19.4
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 +14 -116 4.2.33.19.4 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 *
@@ -145,11 +123,9 @@
145 123 Group_Control_Image_Size::get_type(),
146 124 [
147 125 'name' => 'image', // Usage: `{name}_size` and `{name}_custom_dimension`, in this case `image_size` and `image_custom_dimension`.
148 126 'default' => 'large',
149 - 'condition' => [
150 - 'image[url]!' => '',
151 - ],
127 + 'separator' => 'none',
152 128 ]
153 129 );
154 130
155 131 $this->add_control(
@@ -162,11 +138,8 @@
162 138 'attachment' => esc_html__( 'Attachment Caption', 'elementor' ),
163 139 'custom' => esc_html__( 'Custom Caption', 'elementor' ),
164 140 ],
165 141 'default' => 'none',
166 - 'condition' => [
167 - 'image[url]!' => '',
168 - ],
169 142 ]
170 143 );
171 144
172 145 $this->add_control(
@@ -176,9 +149,8 @@
176 149 'type' => Controls_Manager::TEXT,
177 150 'default' => '',
178 151 'placeholder' => esc_html__( 'Enter your image caption', 'elementor' ),
179 152 'condition' => [
180 - 'image[url]!' => '',
181 153 'caption_source' => 'custom',
182 154 ],
183 155 'dynamic' => [
184 156 'active' => true,
@@ -196,11 +168,8 @@
196 168 'none' => esc_html__( 'None', 'elementor' ),
197 169 'file' => esc_html__( 'Media File', 'elementor' ),
198 170 'custom' => esc_html__( 'Custom URL', 'elementor' ),
199 171 ],
200 - 'condition' => [
201 - 'image[url]!' => '',
202 - ],
203 172 ]
204 173 );
205 174
206 175 $this->add_control(
@@ -211,9 +180,8 @@
211 180 'dynamic' => [
212 181 'active' => true,
213 182 ],
214 183 'condition' => [
215 - 'image[url]!' => '',
216 184 'link_to' => 'custom',
217 185 ],
218 186 'show_label' => false,
219 187 ]
@@ -236,9 +204,8 @@
236 204 'yes' => esc_html__( 'Yes', 'elementor' ),
237 205 'no' => esc_html__( 'No', 'elementor' ),
238 206 ],
239 207 'condition' => [
240 - 'image[url]!' => '',
241 208 'link_to' => 'file',
242 209 ],
243 210 ]
244 211 );
@@ -258,10 +225,10 @@
258 225 [
259 226 'label' => esc_html__( 'Alignment', 'elementor' ),
260 227 'type' => Controls_Manager::CHOOSE,
261 228 'options' => [
262 - 'start' => [
263 - 'title' => esc_html__( 'Start', 'elementor' ),
229 + 'left' => [
230 + 'title' => esc_html__( 'Left', 'elementor' ),
264 231 'icon' => 'eicon-text-align-left',
265 232 ],
266 233 'center' => [
267 234 'title' => esc_html__( 'Center', 'elementor' ),
@@ -266,18 +233,13 @@
266 233 'center' => [
267 234 'title' => esc_html__( 'Center', 'elementor' ),
268 235 'icon' => 'eicon-text-align-center',
269 236 ],
270 - 'end' => [
271 - 'title' => esc_html__( 'End', 'elementor' ),
237 + 'right' => [
238 + 'title' => esc_html__( 'Right', 'elementor' ),
272 239 'icon' => 'eicon-text-align-right',
273 240 ],
274 241 ],
275 - 'classes' => 'elementor-control-start-end',
276 - 'selectors_dictionary' => [
277 - 'left' => is_rtl() ? 'end' : 'start',
278 - 'right' => is_rtl() ? 'start' : 'end',
279 - ],
280 242 'selectors' => [
281 243 '{{WRAPPER}}' => 'text-align: {{VALUE}};',
282 244 ],
283 245 ]
@@ -387,9 +349,8 @@
387 349 '' => esc_html__( 'Default', 'elementor' ),
388 350 'fill' => esc_html__( 'Fill', 'elementor' ),
389 351 'cover' => esc_html__( 'Cover', 'elementor' ),
390 352 'contain' => esc_html__( 'Contain', 'elementor' ),
391 - 'scale-down' => esc_html__( 'Scale Down', 'elementor' ),
392 353 ],
393 354 'default' => '',
394 355 'selectors' => [
395 356 '{{WRAPPER}} img' => 'object-fit: {{VALUE}};',
@@ -417,10 +378,9 @@
417 378 'selectors' => [
418 379 '{{WRAPPER}} img' => 'object-position: {{VALUE}};',
419 380 ],
420 381 'condition' => [
421 - 'height[size]!' => '',
422 - 'object-fit' => [ 'cover', 'contain', 'scale-down' ],
382 + 'object-fit' => 'cover',
423 383 ],
424 384 ]
425 385 );
426 386
@@ -569,9 +529,8 @@
569 529 [
570 530 'label' => esc_html__( 'Caption', 'elementor' ),
571 531 'tab' => Controls_Manager::TAB_STYLE,
572 532 'condition' => [
573 - 'image[url]!' => '',
574 533 'caption_source!' => 'none',
575 534 ],
576 535 ]
577 536 );
@@ -581,10 +540,10 @@
581 540 [
582 541 'label' => esc_html__( 'Alignment', 'elementor' ),
583 542 'type' => Controls_Manager::CHOOSE,
584 543 'options' => [
585 - 'start' => [
586 - 'title' => esc_html__( 'Start', 'elementor' ),
544 + 'left' => [
545 + 'title' => esc_html__( 'Left', 'elementor' ),
587 546 'icon' => 'eicon-text-align-left',
588 547 ],
589 548 'center' => [
590 549 'title' => esc_html__( 'Center', 'elementor' ),
@@ -589,10 +548,10 @@
589 548 'center' => [
590 549 'title' => esc_html__( 'Center', 'elementor' ),
591 550 'icon' => 'eicon-text-align-center',
592 551 ],
593 - 'end' => [
594 - 'title' => esc_html__( 'End', 'elementor' ),
552 + 'right' => [
553 + 'title' => esc_html__( 'Right', 'elementor' ),
595 554 'icon' => 'eicon-text-align-right',
596 555 ],
597 556 'justify' => [
598 557 'title' => esc_html__( 'Justified', 'elementor' ),
@@ -598,13 +557,8 @@
598 557 'title' => esc_html__( 'Justified', 'elementor' ),
599 558 'icon' => 'eicon-text-align-justify',
600 559 ],
601 560 ],
602 - 'classes' => 'elementor-control-start-end',
603 - 'selectors_dictionary' => [
604 - 'left' => is_rtl() ? 'end' : 'start',
605 - 'right' => is_rtl() ? 'start' : 'end',
606 - ],
607 561 'default' => '',
608 562 'selectors' => [
609 563 '{{WRAPPER}} .widget-image-caption' => 'text-align: {{VALUE}};',
610 564 ],
@@ -675,9 +629,9 @@
675 629 'max' => 10,
676 630 ],
677 631 ],
678 632 'selectors' => [
679 - '{{WRAPPER}} .widget-image-caption' => 'margin-block-start: {{SIZE}}{{UNIT}};',
633 + '{{WRAPPER}} .widget-image-caption' => 'margin-top: {{SIZE}}{{UNIT}};',
680 634 ],
681 635 ]
682 636 );
683 637
@@ -702,9 +656,9 @@
702 656 * Get the caption for current widget.
703 657 *
704 658 * @access private
705 659 * @since 2.3.0
706 - * @param array $settings
660 + * @param $settings
707 661 *
708 662 * @return string
709 663 */
710 664 private function get_caption( $settings ) {
@@ -773,64 +727,8 @@
773 727 <?php endif; ?>
774 728 <?php
775 729 }
776 730
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 731 /**
834 732 * Render image widget output in the editor.
835 733 *
836 734 * Written as a Backbone JavaScript template and used to generate the live preview.
@@ -887,9 +785,9 @@
887 785
888 786 var link_url;
889 787
890 788 if ( 'custom' === settings.link_to ) {
891 - link_url = settings.link?.url;
789 + link_url = settings.link.url;
892 790 }
893 791
894 792 if ( 'file' === settings.link_to ) {
895 793 link_url = settings.image.url;
@@ -905,9 +803,9 @@
905 803 #><figure class="wp-caption"><#
906 804 }
907 805
908 806 if ( link_url ) {
909 - #><a class="elementor-clickable" data-elementor-open-lightbox="{{ settings.open_lightbox }}" href="{{ elementor.helpers.sanitizeUrl( link_url ) }}"><#
807 + #><a class="elementor-clickable" data-elementor-open-lightbox="{{ settings.open_lightbox }}" href="{{ link_url }}"><#
910 808 }
911 809 #><img src="{{ image_url }}" class="{{ imgClass }}" /><#
912 810
913 811 if ( link_url ) {