PluginProbe
Elementor Website Builder – more than just a page builder / 3.18.3
Elementor Website Builder – more than just a page builder v3.18.3
4.3.0-beta3 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 All 452 releases
← All changes | includes/widgets/image-carousel.php +39 -133 4.0.73.18.3 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,62 +72,12 @@
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 - /**
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 76 protected function get_upsale_data() {
124 77 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 78 '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' ),
79 + 'upgrade_url' => 'https://go.elementor.com/go-pro-image-carousel-widget/',
131 80 ];
132 81 }
133 82
134 83 /**
@@ -147,17 +96,8 @@
147 96 ]
148 97 );
149 98
150 99 $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 100 'carousel',
161 101 [
162 102 'label' => esc_html__( 'Add Images', 'elementor' ),
163 103 'type' => Controls_Manager::GALLERY,
@@ -172,8 +112,9 @@
172 112 $this->add_group_control(
173 113 Group_Control_Image_Size::get_type(),
174 114 [
175 115 'name' => 'thumbnail', // Usage: `{name}_size` and `{name}_custom_dimension`, in this case `thumbnail_size` and `thumbnail_custom_dimension`.
116 + 'separator' => 'none',
176 117 ]
177 118 );
178 119
179 120 $slides_to_show = range( 1, 10 );
@@ -418,8 +359,17 @@
418 359 ],
419 360 ]
420 361 );
421 362
363 + $this->add_control(
364 + 'view',
365 + [
366 + 'label' => esc_html__( 'View', 'elementor' ),
367 + 'type' => Controls_Manager::HIDDEN,
368 + 'default' => 'traditional',
369 + ]
370 + );
371 +
422 372 $this->end_controls_section();
423 373
424 374 $this->start_controls_section(
425 375 'section_additional_options',
@@ -440,13 +390,14 @@
440 390 $this->add_control(
441 391 'autoplay',
442 392 [
443 393 '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',
394 + 'type' => Controls_Manager::SELECT,
448 395 'default' => 'yes',
396 + 'options' => [
397 + 'yes' => esc_html__( 'Yes', 'elementor' ),
398 + 'no' => esc_html__( 'No', 'elementor' ),
399 + ],
449 400 'frontend_available' => true,
450 401 ]
451 402 );
452 403
@@ -453,13 +404,14 @@
453 404 $this->add_control(
454 405 'pause_on_hover',
455 406 [
456 407 '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',
408 + 'type' => Controls_Manager::SELECT,
461 409 'default' => 'yes',
410 + 'options' => [
411 + 'yes' => esc_html__( 'Yes', 'elementor' ),
412 + 'no' => esc_html__( 'No', 'elementor' ),
413 + ],
462 414 'condition' => [
463 415 'autoplay' => 'yes',
464 416 ],
465 417 'render_type' => 'none',
@@ -470,13 +422,14 @@
470 422 $this->add_control(
471 423 'pause_on_interaction',
472 424 [
473 425 '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',
426 + 'type' => Controls_Manager::SELECT,
478 427 'default' => 'yes',
428 + 'options' => [
429 + 'yes' => esc_html__( 'Yes', 'elementor' ),
430 + 'no' => esc_html__( 'No', 'elementor' ),
431 + ],
479 432 'condition' => [
480 433 'autoplay' => 'yes',
481 434 ],
482 435 'frontend_available' => true,
@@ -501,13 +454,14 @@
501 454 $this->add_control(
502 455 'infinite',
503 456 [
504 457 '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',
458 + 'type' => Controls_Manager::SELECT,
509 459 'default' => 'yes',
460 + 'options' => [
461 + 'yes' => esc_html__( 'Yes', 'elementor' ),
462 + 'no' => esc_html__( 'No', 'elementor' ),
463 + ],
510 464 'frontend_available' => true,
511 465 ]
512 466 );
513 467
@@ -658,28 +612,8 @@
658 612 ]
659 613 );
660 614
661 615 $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(
682 616 'dots_size',
683 617 [
684 618 'label' => esc_html__( 'Size', 'elementor' ),
685 619 'type' => Controls_Manager::SLIDER,
@@ -785,9 +719,9 @@
785 719 'image_spacing_custom',
786 720 [
787 721 'label' => esc_html__( 'Image Spacing', 'elementor' ),
788 722 'type' => Controls_Manager::SLIDER,
789 - 'size_units' => [ 'px' ],
723 + 'size_units' => [ 'px', 'em', 'rem', 'custom' ],
790 724 'range' => [
791 725 'px' => [
792 726 'max' => 100,
793 727 ],
@@ -843,10 +777,10 @@
843 777 [
844 778 'label' => esc_html__( 'Alignment', 'elementor' ),
845 779 'type' => Controls_Manager::CHOOSE,
846 780 'options' => [
847 - 'start' => [
848 - 'title' => esc_html__( 'Start', 'elementor' ),
781 + 'left' => [
782 + 'title' => esc_html__( 'Left', 'elementor' ),
849 783 'icon' => 'eicon-text-align-left',
850 784 ],
851 785 'center' => [
852 786 'title' => esc_html__( 'Center', 'elementor' ),
@@ -851,10 +785,10 @@
851 785 'center' => [
852 786 'title' => esc_html__( 'Center', 'elementor' ),
853 787 'icon' => 'eicon-text-align-center',
854 788 ],
855 - 'end' => [
856 - 'title' => esc_html__( 'End', 'elementor' ),
789 + 'right' => [
790 + 'title' => esc_html__( 'Right', 'elementor' ),
857 791 'icon' => 'eicon-text-align-right',
858 792 ],
859 793 'justify' => [
860 794 'title' => esc_html__( 'Justified', 'elementor' ),
@@ -860,13 +794,8 @@
860 794 'title' => esc_html__( 'Justified', 'elementor' ),
861 795 'icon' => 'eicon-text-align-justify',
862 796 ],
863 797 ],
864 - 'classes' => 'elementor-control-start-end',
865 - 'selectors_dictionary' => [
866 - 'left' => is_rtl() ? 'end' : 'start',
867 - 'right' => is_rtl() ? 'start' : 'end',
868 - ],
869 798 'default' => 'center',
870 799 'selectors' => [
871 800 '{{WRAPPER}} .elementor-image-carousel-caption' => 'text-align: {{VALUE}};',
872 801 ],
@@ -903,20 +832,8 @@
903 832 'selector' => '{{WRAPPER}} .elementor-image-carousel-caption',
904 833 ]
905 834 );
906 835
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 - );
918 -
919 836 $this->end_controls_section();
920 837 }
921 838
922 839 /**
@@ -1013,9 +930,9 @@
1013 930 if ( empty( $slides ) ) {
1014 931 return;
1015 932 }
1016 933
1017 - $swiper_class = 'swiper';
934 + $swiper_class = Plugin::$instance->experiments->is_feature_active( 'e_swiper_latest' ) ? 'swiper' : 'swiper-container';
1018 935 $has_autoplay_enabled = 'yes' === $this->get_settings_for_display( 'autoplay' );
1019 936
1020 937 $this->add_render_attribute( [
1021 938 'carousel' => [
@@ -1023,11 +940,8 @@
1023 940 'aria-live' => $has_autoplay_enabled ? 'off' : 'polite',
1024 941 ],
1025 942 'carousel-wrapper' => [
1026 943 'class' => 'elementor-image-carousel-wrapper ' . $swiper_class,
1027 - 'role' => 'region',
1028 - 'aria-roledescription' => 'carousel',
1029 - 'aria-label' => $settings['carousel_name'],
1030 944 'dir' => $settings['direction'],
1031 945 ],
1032 946 ] );
1033 947
@@ -1041,9 +955,9 @@
1041 955 $slides_count = count( $settings['carousel'] );
1042 956 ?>
1043 957 <div <?php $this->print_render_attribute_string( 'carousel-wrapper' ); ?>>
1044 958 <div <?php $this->print_render_attribute_string( 'carousel' ); ?>>
1045 - <?php // PHPCS - $slides contains the slides content, all the relevant content is escaped above. ?>
959 + <?php // PHPCS - $slides contains the slides content, all the relevent content is escaped above. ?>
1046 960 <?php echo implode( '', $slides ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
1047 961 </div>
1048 962 <?php if ( 1 < $slides_count ) : ?>
1049 963 <?php if ( $show_arrows ) : ?>
@@ -1068,9 +982,9 @@
1068 982 *
1069 983 * @since 1.0.0
1070 984 * @access private
1071 985 *
1072 - * @param array $attachment
986 + * @param array $attachment
1073 987 * @param object $instance
1074 988 *
1075 989 * @return array|string|false An array/string containing the attachment URL, or false if no link.
1076 990 */
@@ -1110,12 +1024,8 @@
1110 1024 }
1111 1025
1112 1026 $attachment_post = get_post( $attachment['id'] );
1113 1027
1114 - if ( Utils::has_invalid_post_permissions( $attachment_post ) ) {
1115 - return '';
1116 - }
1117 -
1118 1028 if ( 'caption' === $caption_type ) {
1119 1029 return $attachment_post->post_excerpt;
1120 1030 }
1121 1031
@@ -1120,12 +1030,8 @@
1120 1030 }
1121 1031
1122 1032 if ( 'title' === $caption_type ) {
1123 1033 return $attachment_post->post_title;
1124 - }
1125 -
1126 - if ( empty( $attachment_post->post_content ) ) {
1127 - return '';
1128 1034 }
1129 1035
1130 1036 return $attachment_post->post_content;
1131 1037 }