PluginProbe
Elementor Website Builder – more than just a page builder / 3.6.7
Elementor Website Builder – more than just a page builder v3.6.7
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-carousel.php +64 -321 4.1.0-dev13.6.7 View file →
@@ -5,9 +5,8 @@
5 5 exit; // Exit if accessed directly.
6 6 }
7 7
8 8 use Elementor\Core\Kits\Documents\Tabs\Global_Colors;
9 -use Elementor\Modules\Promotions\Controls\Promotion_Control;
10 9
11 10 /**
12 11 * Elementor image carousel widget.
13 12 *
@@ -73,66 +72,9 @@
73 72 public function get_keywords() {
74 73 return [ 'image', 'photo', 'visual', 'carousel', 'slider' ];
75 74 }
76 75
77 - protected function is_dynamic_content(): bool {
78 - return false;
79 - }
80 -
81 76 /**
82 - * Get style dependencies.
83 - *
84 - * Retrieve the list of style dependencies the widget requires.
85 - *
86 - * @since 3.24.0
87 - * @access public
88 - *
89 - * @return array Widget style dependencies.
90 - */
91 - public function get_style_depends(): array {
92 - return [ 'e-swiper', 'widget-image-carousel' ];
93 - }
94 -
95 - /**
96 - * Get script dependencies.
97 - *
98 - * Retrieve the list of script dependencies the widget requires.
99 - *
100 - * @since 3.27.0
101 - * @access public
102 - *
103 - * @return array Widget script dependencies.
104 - */
105 - public function get_script_depends(): array {
106 - return [ 'swiper' ];
107 - }
108 -
109 - public function has_widget_inner_wrapper(): bool {
110 - return ! Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
111 - }
112 -
113 - /**
114 - * Get widget upsale data.
115 - *
116 - * Retrieve the widget promotion data.
117 - *
118 - * @since 3.18.0
119 - * @access protected
120 - *
121 - * @return array Widget promotion data.
122 - */
123 - protected function get_upsale_data() {
124 - return [
125 - 'condition' => ! Utils::has_pro(),
126 - 'image' => esc_url( ELEMENTOR_ASSETS_URL . 'images/go-pro.svg' ),
127 - 'image_alt' => esc_attr__( 'Upgrade', 'elementor' ),
128 - 'description' => esc_html__( 'Gain complete freedom to design every slide with Elementor"s Pro Carousel.', 'elementor' ),
129 - 'upgrade_url' => esc_url( 'https://go.elementor.com/go-pro-image-carousel-widget/' ),
130 - 'upgrade_text' => esc_html__( 'Upgrade Now', 'elementor' ),
131 - ];
132 - }
133 -
134 - /**
135 77 * Register image carousel widget controls.
136 78 *
137 79 * Adds different input fields to allow the user to change and customize the widget settings.
138 80 *
@@ -147,17 +89,8 @@
147 89 ]
148 90 );
149 91
150 92 $this->add_control(
151 - 'carousel_name',
152 - [
153 - 'label' => esc_html__( 'Carousel Name', 'elementor' ),
154 - 'type' => Controls_Manager::TEXT,
155 - 'default' => esc_html__( 'Image Carousel', 'elementor' ),
156 - ]
157 - );
158 -
159 - $this->add_control(
160 93 'carousel',
161 94 [
162 95 'label' => esc_html__( 'Add Images', 'elementor' ),
163 96 'type' => Controls_Manager::GALLERY,
@@ -172,8 +105,9 @@
172 105 $this->add_group_control(
173 106 Group_Control_Image_Size::get_type(),
174 107 [
175 108 'name' => 'thumbnail', // Usage: `{name}_size` and `{name}_custom_dimension`, in this case `thumbnail_size` and `thumbnail_custom_dimension`.
109 + 'separator' => 'none',
176 110 ]
177 111 );
178 112
179 113 $slides_to_show = range( 1, 10 );
@@ -191,9 +125,8 @@
191 125 'render_type' => 'template',
192 126 'selectors' => [
193 127 '{{WRAPPER}}' => '--e-image-carousel-slides-to-show: {{VALUE}}',
194 128 ],
195 - 'content_classes' => 'elementor-control-field-select-small',
196 129 ]
197 130 );
198 131
199 132 $this->add_responsive_control(
@@ -208,9 +141,8 @@
208 141 'condition' => [
209 142 'slides_to_show!' => '1',
210 143 ],
211 144 'frontend_available' => true,
212 - 'content_classes' => 'elementor-control-field-select-small',
213 145 ]
214 146 );
215 147
216 148 $this->add_control(
@@ -242,118 +174,8 @@
242 174 ]
243 175 );
244 176
245 177 $this->add_control(
246 - 'navigation_previous_icon',
247 - [
248 - 'label' => esc_html__( 'Previous Arrow Icon', 'elementor' ),
249 - 'type' => Controls_Manager::ICONS,
250 - 'fa4compatibility' => 'icon',
251 - 'skin' => 'inline',
252 - 'label_block' => false,
253 - 'skin_settings' => [
254 - 'inline' => [
255 - 'none' => [
256 - 'label' => 'Default',
257 - 'icon' => 'eicon-chevron-left',
258 - ],
259 - 'icon' => [
260 - 'icon' => 'eicon-star',
261 - ],
262 - ],
263 - ],
264 - 'recommended' => [
265 - 'fa-regular' => [
266 - 'arrow-alt-circle-left',
267 - 'caret-square-left',
268 - ],
269 - 'fa-solid' => [
270 - 'angle-double-left',
271 - 'angle-left',
272 - 'arrow-alt-circle-left',
273 - 'arrow-circle-left',
274 - 'arrow-left',
275 - 'caret-left',
276 - 'caret-square-left',
277 - 'chevron-circle-left',
278 - 'chevron-left',
279 - 'long-arrow-alt-left',
280 - ],
281 - ],
282 - 'conditions' => [
283 - 'relation' => 'or',
284 - 'terms' => [
285 - [
286 - 'name' => 'navigation',
287 - 'operator' => '=',
288 - 'value' => 'both',
289 - ],
290 - [
291 - 'name' => 'navigation',
292 - 'operator' => '=',
293 - 'value' => 'arrows',
294 - ],
295 - ],
296 - ],
297 - ]
298 - );
299 -
300 - $this->add_control(
301 - 'navigation_next_icon',
302 - [
303 - 'label' => esc_html__( 'Next Arrow Icon', 'elementor' ),
304 - 'type' => Controls_Manager::ICONS,
305 - 'fa4compatibility' => 'icon',
306 - 'skin' => 'inline',
307 - 'label_block' => false,
308 - 'skin_settings' => [
309 - 'inline' => [
310 - 'none' => [
311 - 'label' => 'Default',
312 - 'icon' => 'eicon-chevron-right',
313 - ],
314 - 'icon' => [
315 - 'icon' => 'eicon-star',
316 - ],
317 - ],
318 - ],
319 - 'recommended' => [
320 - 'fa-regular' => [
321 - 'arrow-alt-circle-right',
322 - 'caret-square-right',
323 - ],
324 - 'fa-solid' => [
325 - 'angle-double-right',
326 - 'angle-right',
327 - 'arrow-alt-circle-right',
328 - 'arrow-circle-right',
329 - 'arrow-right',
330 - 'caret-right',
331 - 'caret-square-right',
332 - 'chevron-circle-right',
333 - 'chevron-right',
334 - 'long-arrow-alt-right',
335 - ],
336 - ],
337 - 'conditions' => [
338 - 'relation' => 'or',
339 - 'terms' => [
340 - [
341 - 'name' => 'navigation',
342 - 'operator' => '=',
343 - 'value' => 'both',
344 - ],
345 - [
346 - 'name' => 'navigation',
347 - 'operator' => '=',
348 - 'value' => 'arrows',
349 - ],
350 - ],
351 - ],
352 - ]
353 - );
354 -
355 - $this->add_control(
356 178 'link_to',
357 179 [
358 180 'label' => esc_html__( 'Link', 'elementor' ),
359 181 'type' => Controls_Manager::SELECT,
@@ -370,8 +192,9 @@
370 192 'link',
371 193 [
372 194 'label' => esc_html__( 'Link', 'elementor' ),
373 195 'type' => Controls_Manager::URL,
196 + 'placeholder' => esc_html__( 'https://your-link.com', 'elementor' ),
374 197 'condition' => [
375 198 'link_to' => 'custom',
376 199 ],
377 200 'show_label' => false,
@@ -385,14 +208,8 @@
385 208 'open_lightbox',
386 209 [
387 210 'label' => esc_html__( 'Lightbox', 'elementor' ),
388 211 'type' => Controls_Manager::SELECT,
389 - 'description' => sprintf(
390 - /* translators: 1: Link open tag, 2: Link close tag. */
391 - esc_html__( 'Manage your site’s lightbox settings in the %1$sLightbox panel%2$s.', 'elementor' ),
392 - '<a href="javascript: $e.run( \'panel/global/open\' ).then( () => $e.route( \'panel/global/settings-lightbox\' ) )">',
393 - '</a>'
394 - ),
395 212 'default' => 'default',
396 213 'options' => [
397 214 'default' => esc_html__( 'Default', 'elementor' ),
398 215 'yes' => esc_html__( 'Yes', 'elementor' ),
@@ -418,8 +235,17 @@
418 235 ],
419 236 ]
420 237 );
421 238
239 + $this->add_control(
240 + 'view',
241 + [
242 + 'label' => esc_html__( 'View', 'elementor' ),
243 + 'type' => Controls_Manager::HIDDEN,
244 + 'default' => 'traditional',
245 + ]
246 + );
247 +
422 248 $this->end_controls_section();
423 249
424 250 $this->start_controls_section(
425 251 'section_additional_options',
@@ -440,13 +266,14 @@
440 266 $this->add_control(
441 267 'autoplay',
442 268 [
443 269 'label' => esc_html__( 'Autoplay', 'elementor' ),
444 - 'type' => Controls_Manager::SWITCHER,
445 - 'label_on' => esc_html__( 'Yes', 'elementor' ),
446 - 'label_off' => esc_html__( 'No', 'elementor' ),
447 - 'return_value' => 'yes',
270 + 'type' => Controls_Manager::SELECT,
448 271 'default' => 'yes',
272 + 'options' => [
273 + 'yes' => esc_html__( 'Yes', 'elementor' ),
274 + 'no' => esc_html__( 'No', 'elementor' ),
275 + ],
449 276 'frontend_available' => true,
450 277 ]
451 278 );
452 279
@@ -453,13 +280,14 @@
453 280 $this->add_control(
454 281 'pause_on_hover',
455 282 [
456 283 'label' => esc_html__( 'Pause on Hover', 'elementor' ),
457 - 'type' => Controls_Manager::SWITCHER,
458 - 'label_on' => esc_html__( 'Yes', 'elementor' ),
459 - 'label_off' => esc_html__( 'No', 'elementor' ),
460 - 'return_value' => 'yes',
284 + 'type' => Controls_Manager::SELECT,
461 285 'default' => 'yes',
286 + 'options' => [
287 + 'yes' => esc_html__( 'Yes', 'elementor' ),
288 + 'no' => esc_html__( 'No', 'elementor' ),
289 + ],
462 290 'condition' => [
463 291 'autoplay' => 'yes',
464 292 ],
465 293 'render_type' => 'none',
@@ -470,13 +298,14 @@
470 298 $this->add_control(
471 299 'pause_on_interaction',
472 300 [
473 301 'label' => esc_html__( 'Pause on Interaction', 'elementor' ),
474 - 'type' => Controls_Manager::SWITCHER,
475 - 'label_on' => esc_html__( 'Yes', 'elementor' ),
476 - 'label_off' => esc_html__( 'No', 'elementor' ),
477 - 'return_value' => 'yes',
302 + 'type' => Controls_Manager::SELECT,
478 303 'default' => 'yes',
304 + 'options' => [
305 + 'yes' => esc_html__( 'Yes', 'elementor' ),
306 + 'no' => esc_html__( 'No', 'elementor' ),
307 + ],
479 308 'condition' => [
480 309 'autoplay' => 'yes',
481 310 ],
482 311 'frontend_available' => true,
@@ -501,13 +330,14 @@
501 330 $this->add_control(
502 331 'infinite',
503 332 [
504 333 'label' => esc_html__( 'Infinite Loop', 'elementor' ),
505 - 'type' => Controls_Manager::SWITCHER,
506 - 'label_on' => esc_html__( 'Yes', 'elementor' ),
507 - 'label_off' => esc_html__( 'No', 'elementor' ),
508 - 'return_value' => 'yes',
334 + 'type' => Controls_Manager::SELECT,
509 335 'default' => 'yes',
336 + 'options' => [
337 + 'yes' => esc_html__( 'Yes', 'elementor' ),
338 + 'no' => esc_html__( 'No', 'elementor' ),
339 + ],
510 340 'frontend_available' => true,
511 341 ]
512 342 );
513 343
@@ -593,17 +423,17 @@
593 423 ],
594 424 ]
595 425 );
596 426
597 - $this->add_responsive_control(
427 + $this->add_control(
598 428 'arrows_size',
599 429 [
600 430 'label' => esc_html__( 'Size', 'elementor' ),
601 431 'type' => Controls_Manager::SLIDER,
602 - 'size_units' => [ 'px', 'em', 'rem', 'custom' ],
603 432 'range' => [
604 433 'px' => [
605 - 'max' => 100,
434 + 'min' => 20,
435 + 'max' => 60,
606 436 ],
607 437 ],
608 438 'selectors' => [
609 439 '{{WRAPPER}} .elementor-swiper-button.elementor-swiper-button-prev, {{WRAPPER}} .elementor-swiper-button.elementor-swiper-button-next' => 'font-size: {{SIZE}}{{UNIT}};',
@@ -657,37 +487,17 @@
657 487 ],
658 488 ]
659 489 );
660 490
661 - $this->add_responsive_control(
662 - 'dots_gap',
663 - [
664 - 'label' => esc_html__( 'Space Between Dots', 'elementor' ),
665 - 'type' => Controls_Manager::SLIDER,
666 - 'size_units' => [ 'px', 'em', 'rem', 'custom' ],
667 - 'range' => [
668 - 'px' => [
669 - 'max' => 20,
670 - ],
671 - ],
672 - 'selectors' => [
673 - '{{WRAPPER}} .swiper-pagination-bullet' => '--swiper-pagination-bullet-horizontal-gap: {{SIZE}}{{UNIT}}; --swiper-pagination-bullet-vertical-gap: {{SIZE}}{{UNIT}};',
674 - ],
675 - 'condition' => [
676 - 'navigation' => [ 'dots', 'both' ],
677 - ],
678 - ]
679 - );
680 -
681 - $this->add_responsive_control(
491 + $this->add_control(
682 492 'dots_size',
683 493 [
684 494 'label' => esc_html__( 'Size', 'elementor' ),
685 495 'type' => Controls_Manager::SLIDER,
686 - 'size_units' => [ 'px', 'em', 'rem', 'custom' ],
687 496 'range' => [
688 497 'px' => [
689 - 'max' => 20,
498 + 'min' => 5,
499 + 'max' => 10,
690 500 ],
691 501 ],
692 502 'selectors' => [
693 503 '{{WRAPPER}} .swiper-pagination-bullet' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};',
@@ -780,14 +590,13 @@
780 590 ],
781 591 ]
782 592 );
783 593
784 - $this->add_responsive_control(
594 + $this->add_control(
785 595 'image_spacing_custom',
786 596 [
787 597 'label' => esc_html__( 'Image Spacing', 'elementor' ),
788 598 'type' => Controls_Manager::SLIDER,
789 - 'size_units' => [ 'px' ],
790 599 'range' => [
791 600 'px' => [
792 601 'max' => 100,
793 602 ],
@@ -794,8 +603,9 @@
794 603 ],
795 604 'default' => [
796 605 'size' => 20,
797 606 ],
607 + 'show_label' => false,
798 608 'condition' => [
799 609 'image_spacing' => 'custom',
800 610 'slides_to_show!' => '1',
801 611 ],
@@ -812,14 +622,14 @@
812 622 'selector' => '{{WRAPPER}} .elementor-image-carousel-wrapper .elementor-image-carousel .swiper-slide-image',
813 623 ]
814 624 );
815 625
816 - $this->add_responsive_control(
626 + $this->add_control(
817 627 'image_border_radius',
818 628 [
819 629 'label' => esc_html__( 'Border Radius', 'elementor' ),
820 630 'type' => Controls_Manager::DIMENSIONS,
821 - 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
631 + 'size_units' => [ 'px', '%' ],
822 632 'selectors' => [
823 633 '{{WRAPPER}} .elementor-image-carousel-wrapper .elementor-image-carousel .swiper-slide-image' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
824 634 ],
825 635 ]
@@ -837,16 +647,16 @@
837 647 ],
838 648 ]
839 649 );
840 650
841 - $this->add_responsive_control(
651 + $this->add_control(
842 652 'caption_align',
843 653 [
844 654 'label' => esc_html__( 'Alignment', 'elementor' ),
845 655 'type' => Controls_Manager::CHOOSE,
846 656 'options' => [
847 - 'start' => [
848 - 'title' => esc_html__( 'Start', 'elementor' ),
657 + 'left' => [
658 + 'title' => esc_html__( 'Left', 'elementor' ),
849 659 'icon' => 'eicon-text-align-left',
850 660 ],
851 661 'center' => [
852 662 'title' => esc_html__( 'Center', 'elementor' ),
@@ -851,10 +661,10 @@
851 661 'center' => [
852 662 'title' => esc_html__( 'Center', 'elementor' ),
853 663 'icon' => 'eicon-text-align-center',
854 664 ],
855 - 'end' => [
856 - 'title' => esc_html__( 'End', 'elementor' ),
665 + 'right' => [
666 + 'title' => esc_html__( 'Right', 'elementor' ),
857 667 'icon' => 'eicon-text-align-right',
858 668 ],
859 669 'justify' => [
860 670 'title' => esc_html__( 'Justified', 'elementor' ),
@@ -860,13 +670,8 @@
860 670 'title' => esc_html__( 'Justified', 'elementor' ),
861 671 'icon' => 'eicon-text-align-justify',
862 672 ],
863 673 ],
864 - 'classes' => 'elementor-control-start-end',
865 - 'selectors_dictionary' => [
866 - 'left' => is_rtl() ? 'end' : 'start',
867 - 'right' => is_rtl() ? 'start' : 'end',
868 - ],
869 674 'default' => 'center',
870 675 'selectors' => [
871 676 '{{WRAPPER}} .elementor-image-carousel-caption' => 'text-align: {{VALUE}};',
872 677 ],
@@ -903,21 +708,10 @@
903 708 'selector' => '{{WRAPPER}} .elementor-image-carousel-caption',
904 709 ]
905 710 );
906 711
907 - $this->add_responsive_control(
908 - 'caption_space',
909 - [
910 - 'label' => esc_html__( 'Spacing', 'elementor' ),
911 - 'type' => Controls_Manager::SLIDER,
912 - 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
913 - 'selectors' => [
914 - '{{WRAPPER}} .elementor-image-carousel-caption' => 'margin-block-start: {{SIZE}}{{UNIT}};',
915 - ],
916 - ]
917 - );
712 + $this->end_controls_section();
918 713
919 - $this->end_controls_section();
920 714 }
921 715
922 716 /**
923 717 * Render image carousel widget output on the frontend.
@@ -972,25 +766,10 @@
972 766 }
973 767
974 768 $image_caption = $this->get_image_caption( $attachment );
975 769
976 - $slide_count = $index + 1;
977 - $slide_setting_key = 'swiper_slide_' . $index;
770 + $slide_html = '<div class="swiper-slide">' . $link_tag . '<figure class="swiper-slide-inner">' . $image_html;
978 771
979 - $this->add_render_attribute( $slide_setting_key, [
980 - 'class' => 'swiper-slide',
981 - 'role' => 'group',
982 - 'aria-roledescription' => 'slide',
983 - 'aria-label' => sprintf(
984 - /* translators: 1: Slide count, 2: Total slides count. */
985 - esc_html__( '%1$s of %2$s', 'elementor' ),
986 - $slide_count,
987 - count( $settings['carousel'] )
988 - ),
989 - ] );
990 -
991 - $slide_html = '<div ' . $this->get_render_attribute_string( $slide_setting_key ) . '>' . $link_tag . '<figure class="swiper-slide-inner">' . $image_html;
992 -
993 772 if ( $lazyload ) {
994 773 $slide_html .= '<div class="swiper-lazy-preloader"></div>';
995 774 }
996 775
@@ -1013,21 +792,14 @@
1013 792 if ( empty( $slides ) ) {
1014 793 return;
1015 794 }
1016 795
1017 - $swiper_class = 'swiper';
1018 - $has_autoplay_enabled = 'yes' === $this->get_settings_for_display( 'autoplay' );
1019 -
1020 796 $this->add_render_attribute( [
1021 797 'carousel' => [
1022 798 'class' => 'elementor-image-carousel swiper-wrapper',
1023 - 'aria-live' => $has_autoplay_enabled ? 'off' : 'polite',
1024 799 ],
1025 800 'carousel-wrapper' => [
1026 - 'class' => 'elementor-image-carousel-wrapper ' . $swiper_class,
1027 - 'role' => 'region',
1028 - 'aria-roledescription' => 'carousel',
1029 - 'aria-label' => $settings['carousel_name'],
801 + 'class' => 'elementor-image-carousel-wrapper swiper-container',
1030 802 'dir' => $settings['direction'],
1031 803 ],
1032 804 ] );
1033 805
@@ -1038,27 +810,29 @@
1038 810 $this->add_render_attribute( 'carousel', 'class', 'swiper-image-stretch' );
1039 811 }
1040 812
1041 813 $slides_count = count( $settings['carousel'] );
814 +
1042 815 ?>
1043 816 <div <?php $this->print_render_attribute_string( 'carousel-wrapper' ); ?>>
1044 817 <div <?php $this->print_render_attribute_string( 'carousel' ); ?>>
1045 - <?php // PHPCS - $slides contains the slides content, all the relevant content is escaped above. ?>
818 + <?php // PHPCS - $slides contains the slides content, all the relevent content is escaped above. ?>
1046 819 <?php echo implode( '', $slides ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
1047 820 </div>
1048 821 <?php if ( 1 < $slides_count ) : ?>
822 + <?php if ( $show_dots ) : ?>
823 + <div class="swiper-pagination"></div>
824 + <?php endif; ?>
1049 825 <?php if ( $show_arrows ) : ?>
1050 - <div class="elementor-swiper-button elementor-swiper-button-prev" role="button" tabindex="0">
826 + <div class="elementor-swiper-button elementor-swiper-button-prev">
1051 827 <?php $this->render_swiper_button( 'previous' ); ?>
828 + <span class="elementor-screen-only"><?php echo esc_html__( 'Previous', 'elementor' ); ?></span>
1052 829 </div>
1053 - <div class="elementor-swiper-button elementor-swiper-button-next" role="button" tabindex="0">
830 + <div class="elementor-swiper-button elementor-swiper-button-next">
1054 831 <?php $this->render_swiper_button( 'next' ); ?>
832 + <span class="elementor-screen-only"><?php echo esc_html__( 'Next', 'elementor' ); ?></span>
1055 833 </div>
1056 834 <?php endif; ?>
1057 -
1058 - <?php if ( $show_dots ) : ?>
1059 - <div class="swiper-pagination"></div>
1060 - <?php endif; ?>
1061 835 <?php endif; ?>
1062 836 </div>
1063 837 <?php
1064 838 }
@@ -1068,9 +842,9 @@
1068 842 *
1069 843 * @since 1.0.0
1070 844 * @access private
1071 845 *
1072 - * @param array $attachment
846 + * @param array $attachment
1073 847 * @param object $instance
1074 848 *
1075 849 * @return array|string|false An array/string containing the attachment URL, or false if no link.
1076 850 */
@@ -1110,12 +884,8 @@
1110 884 }
1111 885
1112 886 $attachment_post = get_post( $attachment['id'] );
1113 887
1114 - if ( Utils::has_invalid_post_permissions( $attachment_post ) ) {
1115 - return '';
1116 - }
1117 -
1118 888 if ( 'caption' === $caption_type ) {
1119 889 return $attachment_post->post_excerpt;
1120 890 }
1121 891
@@ -1122,45 +892,18 @@
1122 892 if ( 'title' === $caption_type ) {
1123 893 return $attachment_post->post_title;
1124 894 }
1125 895
1126 - if ( empty( $attachment_post->post_content ) ) {
1127 - return '';
1128 - }
1129 -
1130 896 return $attachment_post->post_content;
1131 897 }
1132 898
1133 899 private function render_swiper_button( $type ) {
1134 900 $direction = 'next' === $type ? 'right' : 'left';
1135 - $icon_settings = $this->get_settings_for_display( 'navigation_' . $type . '_icon' );
1136 901
1137 - if ( empty( $icon_settings['value'] ) ) {
1138 - $icon_settings = [
1139 - 'library' => 'eicons',
1140 - 'value' => 'eicon-chevron-' . $direction,
1141 - ];
1142 - }
902 + $icon_value = 'eicon-chevron-' . $direction;
1143 903
1144 - Icons_Manager::render_icon( $icon_settings, [ 'aria-hidden' => 'true' ] );
1145 - }
1146 -
1147 - public function render_markdown(): string {
1148 - $settings = $this->get_settings_for_display();
1149 - if ( empty( $settings['carousel'] ) ) {
1150 - return '';
1151 - }
1152 - $images = [];
1153 - foreach ( $settings['carousel'] as $item ) {
1154 - $url = $item['url'] ?? '';
1155 - if ( empty( $url ) ) {
1156 - continue;
1157 - }
1158 - $alt = '';
1159 - if ( ! empty( $item['id'] ) ) {
1160 - $alt = get_post_meta( $item['id'], '_wp_attachment_image_alt', true );
1161 - }
1162 - $images[] = '![' . $alt . '](' . esc_url( $url ) . ')';
1163 - }
1164 - return implode( "\n\n", $images );
904 + Icons_Manager::render_icon( [
905 + 'library' => 'eicons',
906 + 'value' => $icon_value,
907 + ], [ 'aria-hidden' => 'true' ] );
1165 908 }
1166 909 }