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-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-gallery.php +36 -167 4.2.0-dev23.6.7 View file →
@@ -71,52 +71,9 @@
71 71 public function get_keywords() {
72 72 return [ 'image', 'photo', 'visual', 'gallery' ];
73 73 }
74 74
75 - protected function is_dynamic_content(): bool {
76 - return false;
77 - }
78 -
79 75 /**
80 - * Get style dependencies.
81 - *
82 - * Retrieve the list of style dependencies the widget requires.
83 - *
84 - * @since 3.24.0
85 - * @access public
86 - *
87 - * @return array Widget style dependencies.
88 - */
89 - public function get_style_depends(): array {
90 - return [ 'widget-image-gallery' ];
91 - }
92 -
93 - /**
94 - * Get widget upsale data.
95 - *
96 - * Retrieve the widget promotion data.
97 - *
98 - * @since 3.18.0
99 - * @access protected
100 - *
101 - * @return array Widget promotion data.
102 - */
103 - protected function get_upsale_data() {
104 - return [
105 - 'condition' => ! Utils::has_pro(),
106 - 'image' => esc_url( ELEMENTOR_ASSETS_URL . 'images/go-pro.svg' ),
107 - 'image_alt' => esc_attr__( 'Upgrade', 'elementor' ),
108 - 'description' => esc_html__( 'Use interesting masonry layouts and other overlay features with Elementor\'s Pro Gallery widget.', 'elementor' ),
109 - 'upgrade_url' => esc_url( 'https://go.elementor.com/go-pro-basic-gallery-widget/' ),
110 - 'upgrade_text' => esc_html__( 'Upgrade Now', 'elementor' ),
111 - ];
112 - }
113 -
114 - public function has_widget_inner_wrapper(): bool {
115 - return ! Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
116 - }
117 -
118 - /**
119 76 * Register image gallery widget controls.
120 77 *
121 78 * Adds different input fields to allow the user to change and customize the widget settings.
122 79 *
@@ -126,9 +83,9 @@
126 83 protected function register_controls() {
127 84 $this->start_controls_section(
128 85 'section_gallery',
129 86 [
130 - 'label' => esc_html__( 'Basic Gallery', 'elementor' ),
87 + 'label' => esc_html__( 'Image Gallery', 'elementor' ),
131 88 ]
132 89 );
133 90
134 91 $this->add_control(
@@ -147,8 +104,9 @@
147 104 Group_Control_Image_Size::get_type(),
148 105 [
149 106 'name' => 'thumbnail', // Usage: `{name}_size` and `{name}_custom_dimension`, in this case `thumbnail_size` and `thumbnail_custom_dimension`.
150 107 'exclude' => [ 'custom' ],
108 + 'separator' => 'none',
151 109 ]
152 110 );
153 111
154 112 $gallery_columns = range( 1, 10 );
@@ -164,24 +122,8 @@
164 122 ]
165 123 );
166 124
167 125 $this->add_control(
168 - 'gallery_display_caption',
169 - [
170 - 'label' => esc_html__( 'Caption', 'elementor' ),
171 - 'type' => Controls_Manager::SELECT,
172 - 'default' => '',
173 - 'options' => [
174 - 'none' => esc_html__( 'None', 'elementor' ),
175 - '' => esc_html__( 'Attachment Caption', 'elementor' ),
176 - ],
177 - 'selectors' => [
178 - '{{WRAPPER}} .gallery-item .gallery-caption' => 'display: {{VALUE}};',
179 - ],
180 - ]
181 - );
182 -
183 - $this->add_control(
184 126 'gallery_link',
185 127 [
186 128 'label' => esc_html__( 'Link', 'elementor' ),
187 129 'type' => Controls_Manager::SELECT,
@@ -198,14 +140,8 @@
198 140 'open_lightbox',
199 141 [
200 142 'label' => esc_html__( 'Lightbox', 'elementor' ),
201 143 'type' => Controls_Manager::SELECT,
202 - 'description' => sprintf(
203 - /* translators: 1: Link open tag, 2: Link close tag. */
204 - esc_html__( 'Manage your site’s lightbox settings in the %1$sLightbox panel%2$s.', 'elementor' ),
205 - '<a href="javascript: $e.run( \'panel/global/open\' ).then( () => $e.route( \'panel/global/settings-lightbox\' ) )">',
206 - '</a>'
207 - ),
208 144 'default' => 'default',
209 145 'options' => [
210 146 'default' => esc_html__( 'Default', 'elementor' ),
211 147 'yes' => esc_html__( 'Yes', 'elementor' ),
@@ -213,48 +149,8 @@
213 149 ],
214 150 'condition' => [
215 151 'gallery_link' => 'file',
216 152 ],
217 - 'assets' => [
218 - 'styles' => [
219 - [
220 - 'name' => 'e-swiper',
221 - 'conditions' => [
222 - 'terms' => [
223 - [
224 - 'name' => 'gallery_link',
225 - 'operator' => '===',
226 - 'value' => 'file',
227 - ],
228 - [
229 - 'name' => 'open_lightbox',
230 - 'operator' => '!==',
231 - 'value' => 'no',
232 - ],
233 - ],
234 - ],
235 - ],
236 - ],
237 - 'scripts' => [
238 - [
239 - 'name' => 'swiper',
240 - 'conditions' => [
241 - 'terms' => [
242 - [
243 - 'name' => 'gallery_link',
244 - 'operator' => '===',
245 - 'value' => 'file',
246 - ],
247 - [
248 - 'name' => 'open_lightbox',
249 - 'operator' => '!==',
250 - 'value' => 'no',
251 - ],
252 - ],
253 - ],
254 - ],
255 - ],
256 - ],
257 153 ]
258 154 );
259 155
260 156 $this->add_control(
@@ -269,8 +165,17 @@
269 165 'default' => '',
270 166 ]
271 167 );
272 168
169 + $this->add_control(
170 + 'view',
171 + [
172 + 'label' => esc_html__( 'View', 'elementor' ),
173 + 'type' => Controls_Manager::HIDDEN,
174 + 'default' => 'traditional',
175 + ]
176 + );
177 +
273 178 $this->end_controls_section();
274 179
275 180 $this->start_controls_section(
276 181 'section_gallery_images',
@@ -282,9 +187,9 @@
282 187
283 188 $this->add_control(
284 189 'image_spacing',
285 190 [
286 - 'label' => esc_html__( 'Gap', 'elementor' ),
191 + 'label' => esc_html__( 'Spacing', 'elementor' ),
287 192 'type' => Controls_Manager::SELECT,
288 193 'options' => [
289 194 '' => esc_html__( 'Default', 'elementor' ),
290 195 'custom' => esc_html__( 'Custom', 'elementor' ),
@@ -299,21 +204,15 @@
299 204
300 205 $this->add_control(
301 206 'image_spacing_custom',
302 207 [
303 - 'label' => esc_html__( 'Custom Gap', 'elementor' ),
208 + 'label' => esc_html__( 'Image Spacing', 'elementor' ),
304 209 'type' => Controls_Manager::SLIDER,
305 - 'size_units' => [ 'px', 'em', 'rem', 'custom' ],
210 + 'show_label' => false,
306 211 'range' => [
307 212 'px' => [
308 213 'max' => 100,
309 214 ],
310 - 'em' => [
311 - 'max' => 10,
312 - ],
313 - 'rem' => [
314 - 'max' => 10,
315 - ],
316 215 ],
317 216 'default' => [
318 217 'size' => 15,
319 218 ],
@@ -335,14 +234,14 @@
335 234 'separator' => 'before',
336 235 ]
337 236 );
338 237
339 - $this->add_responsive_control(
238 + $this->add_control(
340 239 'image_border_radius',
341 240 [
342 241 'label' => esc_html__( 'Border Radius', 'elementor' ),
343 242 'type' => Controls_Manager::DIMENSIONS,
344 - 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
243 + 'size_units' => [ 'px', '%' ],
345 244 'selectors' => [
346 245 '{{WRAPPER}} .gallery-item img' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
347 246 ],
348 247 ]
@@ -354,22 +253,35 @@
354 253 'section_caption',
355 254 [
356 255 'label' => esc_html__( 'Caption', 'elementor' ),
357 256 'tab' => Controls_Manager::TAB_STYLE,
358 - 'condition' => [
359 - 'gallery_display_caption' => '',
257 + ]
258 + );
259 +
260 + $this->add_control(
261 + 'gallery_display_caption',
262 + [
263 + 'label' => esc_html__( 'Display', 'elementor' ),
264 + 'type' => Controls_Manager::SELECT,
265 + 'default' => '',
266 + 'options' => [
267 + '' => esc_html__( 'Show', 'elementor' ),
268 + 'none' => esc_html__( 'Hide', 'elementor' ),
360 269 ],
270 + 'selectors' => [
271 + '{{WRAPPER}} .gallery-item .gallery-caption' => 'display: {{VALUE}};',
272 + ],
361 273 ]
362 274 );
363 275
364 - $this->add_responsive_control(
276 + $this->add_control(
365 277 'align',
366 278 [
367 279 'label' => esc_html__( 'Alignment', 'elementor' ),
368 280 'type' => Controls_Manager::CHOOSE,
369 281 'options' => [
370 - 'start' => [
371 - 'title' => esc_html__( 'Start', 'elementor' ),
282 + 'left' => [
283 + 'title' => esc_html__( 'Left', 'elementor' ),
372 284 'icon' => 'eicon-text-align-left',
373 285 ],
374 286 'center' => [
375 287 'title' => esc_html__( 'Center', 'elementor' ),
@@ -374,10 +286,10 @@
374 286 'center' => [
375 287 'title' => esc_html__( 'Center', 'elementor' ),
376 288 'icon' => 'eicon-text-align-center',
377 289 ],
378 - 'end' => [
379 - 'title' => esc_html__( 'End', 'elementor' ),
290 + 'right' => [
291 + 'title' => esc_html__( 'Right', 'elementor' ),
380 292 'icon' => 'eicon-text-align-right',
381 293 ],
382 294 'justify' => [
383 295 'title' => esc_html__( 'Justified', 'elementor' ),
@@ -383,13 +295,8 @@
383 295 'title' => esc_html__( 'Justified', 'elementor' ),
384 296 'icon' => 'eicon-text-align-justify',
385 297 ],
386 298 ],
387 - 'classes' => 'elementor-control-start-end',
388 - 'selectors_dictionary' => [
389 - 'left' => is_rtl() ? 'end' : 'start',
390 - 'right' => is_rtl() ? 'start' : 'end',
391 - ],
392 299 'default' => 'center',
393 300 'selectors' => [
394 301 '{{WRAPPER}} .gallery-item .gallery-caption' => 'text-align: {{VALUE}};',
395 302 ],
@@ -432,29 +339,11 @@
432 339 Group_Control_Text_Shadow::get_type(),
433 340 [
434 341 'name' => 'caption_shadow',
435 342 'selector' => '{{WRAPPER}} .gallery-item .gallery-caption',
436 - 'condition' => [
437 - 'gallery_display_caption' => '',
438 - ],
439 343 ]
440 344 );
441 345
442 - $this->add_responsive_control(
443 - 'caption_space',
444 - [
445 - 'label' => esc_html__( 'Spacing', 'elementor' ),
446 - 'type' => Controls_Manager::SLIDER,
447 - 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
448 - 'selectors' => [
449 - '{{WRAPPER}} .gallery-item .gallery-caption' => 'margin-block-start: {{SIZE}}{{UNIT}};',
450 - ],
451 - 'condition' => [
452 - 'gallery_display_caption' => '',
453 - ],
454 - ]
455 - );
456 -
457 346 $this->end_controls_section();
458 347 }
459 348
460 349 /**
@@ -498,26 +387,6 @@
498 387 remove_filter( 'wp_get_attachment_link', [ $this, 'add_lightbox_data_to_image_link' ] );
499 388 ?>
500 389 </div>
501 390 <?php
502 - }
503 -
504 - public function render_markdown(): string {
505 - $settings = $this->get_settings_for_display();
506 - if ( empty( $settings['wp_gallery'] ) ) {
507 - return '';
508 - }
509 - $images = [];
510 - foreach ( $settings['wp_gallery'] as $image ) {
511 - $url = $image['url'] ?? '';
512 - if ( empty( $url ) ) {
513 - continue;
514 - }
515 - $alt = '';
516 - if ( ! empty( $image['id'] ) ) {
517 - $alt = get_post_meta( $image['id'], '_wp_attachment_image_alt', true );
518 - }
519 - $images[] = '![' . $alt . '](' . esc_url( $url ) . ')';
520 - }
521 - return implode( "\n\n", $images );
522 391 }
523 392 }