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 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 All 453 releases
← All changes | includes/widgets/image-gallery.php +34 -152 4.1.23.18.3 View file →
@@ -71,51 +71,15 @@
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 - /**
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 75 protected function get_upsale_data() {
104 76 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 77 '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' ),
78 + 'upgrade_url' => 'https://go.elementor.com/go-pro-basic-gallery-widget/',
111 79 ];
112 80 }
113 81
114 - public function has_widget_inner_wrapper(): bool {
115 - return ! Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
116 - }
117 -
118 82 /**
119 83 * Register image gallery widget controls.
120 84 *
121 85 * Adds different input fields to allow the user to change and customize the widget settings.
@@ -126,9 +90,9 @@
126 90 protected function register_controls() {
127 91 $this->start_controls_section(
128 92 'section_gallery',
129 93 [
130 - 'label' => esc_html__( 'Basic Gallery', 'elementor' ),
94 + 'label' => esc_html__( 'Image Gallery', 'elementor' ),
131 95 ]
132 96 );
133 97
134 98 $this->add_control(
@@ -147,8 +111,9 @@
147 111 Group_Control_Image_Size::get_type(),
148 112 [
149 113 'name' => 'thumbnail', // Usage: `{name}_size` and `{name}_custom_dimension`, in this case `thumbnail_size` and `thumbnail_custom_dimension`.
150 114 'exclude' => [ 'custom' ],
115 + 'separator' => 'none',
151 116 ]
152 117 );
153 118
154 119 $gallery_columns = range( 1, 10 );
@@ -164,24 +129,8 @@
164 129 ]
165 130 );
166 131
167 132 $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 133 'gallery_link',
185 134 [
186 135 'label' => esc_html__( 'Link', 'elementor' ),
187 136 'type' => Controls_Manager::SELECT,
@@ -213,48 +162,8 @@
213 162 ],
214 163 'condition' => [
215 164 'gallery_link' => 'file',
216 165 ],
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 166 ]
258 167 );
259 168
260 169 $this->add_control(
@@ -269,8 +178,17 @@
269 178 'default' => '',
270 179 ]
271 180 );
272 181
182 + $this->add_control(
183 + 'view',
184 + [
185 + 'label' => esc_html__( 'View', 'elementor' ),
186 + 'type' => Controls_Manager::HIDDEN,
187 + 'default' => 'traditional',
188 + ]
189 + );
190 +
273 191 $this->end_controls_section();
274 192
275 193 $this->start_controls_section(
276 194 'section_gallery_images',
@@ -282,9 +200,9 @@
282 200
283 201 $this->add_control(
284 202 'image_spacing',
285 203 [
286 - 'label' => esc_html__( 'Gap', 'elementor' ),
204 + 'label' => esc_html__( 'Spacing', 'elementor' ),
287 205 'type' => Controls_Manager::SELECT,
288 206 'options' => [
289 207 '' => esc_html__( 'Default', 'elementor' ),
290 208 'custom' => esc_html__( 'Custom', 'elementor' ),
@@ -299,21 +217,15 @@
299 217
300 218 $this->add_control(
301 219 'image_spacing_custom',
302 220 [
303 - 'label' => esc_html__( 'Custom Gap', 'elementor' ),
221 + 'label' => esc_html__( 'Image Spacing', 'elementor' ),
304 222 'type' => Controls_Manager::SLIDER,
305 - 'size_units' => [ 'px', 'em', 'rem', 'custom' ],
223 + 'show_label' => false,
306 224 'range' => [
307 225 'px' => [
308 226 'max' => 100,
309 227 ],
310 - 'em' => [
311 - 'max' => 10,
312 - ],
313 - 'rem' => [
314 - 'max' => 10,
315 - ],
316 228 ],
317 229 'default' => [
318 230 'size' => 15,
319 231 ],
@@ -354,11 +266,24 @@
354 266 'section_caption',
355 267 [
356 268 'label' => esc_html__( 'Caption', 'elementor' ),
357 269 'tab' => Controls_Manager::TAB_STYLE,
358 - 'condition' => [
359 - 'gallery_display_caption' => '',
270 + ]
271 + );
272 +
273 + $this->add_control(
274 + 'gallery_display_caption',
275 + [
276 + 'label' => esc_html__( 'Display', 'elementor' ),
277 + 'type' => Controls_Manager::SELECT,
278 + 'default' => '',
279 + 'options' => [
280 + '' => esc_html__( 'Show', 'elementor' ),
281 + 'none' => esc_html__( 'Hide', 'elementor' ),
360 282 ],
283 + 'selectors' => [
284 + '{{WRAPPER}} .gallery-item .gallery-caption' => 'display: {{VALUE}};',
285 + ],
361 286 ]
362 287 );
363 288
364 289 $this->add_responsive_control(
@@ -366,10 +291,10 @@
366 291 [
367 292 'label' => esc_html__( 'Alignment', 'elementor' ),
368 293 'type' => Controls_Manager::CHOOSE,
369 294 'options' => [
370 - 'start' => [
371 - 'title' => esc_html__( 'Start', 'elementor' ),
295 + 'left' => [
296 + 'title' => esc_html__( 'Left', 'elementor' ),
372 297 'icon' => 'eicon-text-align-left',
373 298 ],
374 299 'center' => [
375 300 'title' => esc_html__( 'Center', 'elementor' ),
@@ -374,10 +299,10 @@
374 299 'center' => [
375 300 'title' => esc_html__( 'Center', 'elementor' ),
376 301 'icon' => 'eicon-text-align-center',
377 302 ],
378 - 'end' => [
379 - 'title' => esc_html__( 'End', 'elementor' ),
303 + 'right' => [
304 + 'title' => esc_html__( 'Right', 'elementor' ),
380 305 'icon' => 'eicon-text-align-right',
381 306 ],
382 307 'justify' => [
383 308 'title' => esc_html__( 'Justified', 'elementor' ),
@@ -383,13 +308,8 @@
383 308 'title' => esc_html__( 'Justified', 'elementor' ),
384 309 'icon' => 'eicon-text-align-justify',
385 310 ],
386 311 ],
387 - 'classes' => 'elementor-control-start-end',
388 - 'selectors_dictionary' => [
389 - 'left' => is_rtl() ? 'end' : 'start',
390 - 'right' => is_rtl() ? 'start' : 'end',
391 - ],
392 312 'default' => 'center',
393 313 'selectors' => [
394 314 '{{WRAPPER}} .gallery-item .gallery-caption' => 'text-align: {{VALUE}};',
395 315 ],
@@ -432,29 +352,11 @@
432 352 Group_Control_Text_Shadow::get_type(),
433 353 [
434 354 'name' => 'caption_shadow',
435 355 'selector' => '{{WRAPPER}} .gallery-item .gallery-caption',
436 - 'condition' => [
437 - 'gallery_display_caption' => '',
438 - ],
439 356 ]
440 357 );
441 358
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 359 $this->end_controls_section();
458 360 }
459 361
460 362 /**
@@ -498,26 +400,6 @@
498 400 remove_filter( 'wp_get_attachment_link', [ $this, 'add_lightbox_data_to_image_link' ] );
499 401 ?>
500 402 </div>
501 403 <?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 404 }
523 405 }