PluginProbe
Elementor Website Builder – more than just a page builder / 3.21.3
Elementor Website Builder – more than just a page builder v3.21.3
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 +8 -110 4.2.0-dev23.21.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,45 +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 77 * Get widget upsale data.
115 78 *
116 79 * Retrieve the widget promotion data.
117 80 *
@@ -147,17 +110,8 @@
147 110 ]
148 111 );
149 112
150 113 $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 114 'carousel',
161 115 [
162 116 'label' => esc_html__( 'Add Images', 'elementor' ),
163 117 'type' => Controls_Manager::GALLERY,
@@ -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 ],
@@ -1013,9 +942,9 @@
1013 942 if ( empty( $slides ) ) {
1014 943 return;
1015 944 }
1016 945
1017 - $swiper_class = 'swiper';
946 + $swiper_class = Plugin::$instance->experiments->is_feature_active( 'e_swiper_latest' ) ? 'swiper' : 'swiper-container';
1018 947 $has_autoplay_enabled = 'yes' === $this->get_settings_for_display( 'autoplay' );
1019 948
1020 949 $this->add_render_attribute( [
1021 950 'carousel' => [
@@ -1023,11 +952,8 @@
1023 952 'aria-live' => $has_autoplay_enabled ? 'off' : 'polite',
1024 953 ],
1025 954 'carousel-wrapper' => [
1026 955 'class' => 'elementor-image-carousel-wrapper ' . $swiper_class,
1027 - 'role' => 'region',
1028 - 'aria-roledescription' => 'carousel',
1029 - 'aria-label' => $settings['carousel_name'],
1030 956 'dir' => $settings['direction'],
1031 957 ],
1032 958 ] );
1033 959
@@ -1041,9 +967,9 @@
1041 967 $slides_count = count( $settings['carousel'] );
1042 968 ?>
1043 969 <div <?php $this->print_render_attribute_string( 'carousel-wrapper' ); ?>>
1044 970 <div <?php $this->print_render_attribute_string( 'carousel' ); ?>>
1045 - <?php // PHPCS - $slides contains the slides content, all the relevant content is escaped above. ?>
971 + <?php // PHPCS - $slides contains the slides content, all the relevent content is escaped above. ?>
1046 972 <?php echo implode( '', $slides ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
1047 973 </div>
1048 974 <?php if ( 1 < $slides_count ) : ?>
1049 975 <?php if ( $show_arrows ) : ?>
@@ -1068,9 +994,9 @@
1068 994 *
1069 995 * @since 1.0.0
1070 996 * @access private
1071 997 *
1072 - * @param array $attachment
998 + * @param array $attachment
1073 999 * @param object $instance
1074 1000 *
1075 1001 * @return array|string|false An array/string containing the attachment URL, or false if no link.
1076 1002 */
@@ -1110,12 +1036,8 @@
1110 1036 }
1111 1037
1112 1038 $attachment_post = get_post( $attachment['id'] );
1113 1039
1114 - if ( Utils::has_invalid_post_permissions( $attachment_post ) ) {
1115 - return '';
1116 - }
1117 -
1118 1040 if ( 'caption' === $caption_type ) {
1119 1041 return $attachment_post->post_excerpt;
1120 1042 }
1121 1043
@@ -1122,12 +1044,8 @@
1122 1044 if ( 'title' === $caption_type ) {
1123 1045 return $attachment_post->post_title;
1124 1046 }
1125 1047
1126 - if ( empty( $attachment_post->post_content ) ) {
1127 - return '';
1128 - }
1129 -
1130 1048 return $attachment_post->post_content;
1131 1049 }
1132 1050
1133 1051 private function render_swiper_button( $type ) {
@@ -1141,26 +1059,6 @@
1141 1059 ];
1142 1060 }
1143 1061
1144 1062 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 );
1165 1063 }
1166 1064 }