PluginProbe
Elementor Website Builder – more than just a page builder / 3.13.3
Elementor Website Builder – more than just a page builder v3.13.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-gallery.php +33 -158 4.3.0-beta33.13.3 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,
@@ -213,48 +155,8 @@
213 155 ],
214 156 'condition' => [
215 157 'gallery_link' => 'file',
216 158 ],
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 159 ]
258 160 );
259 161
260 162 $this->add_control(
@@ -269,8 +171,17 @@
269 171 'default' => '',
270 172 ]
271 173 );
272 174
175 + $this->add_control(
176 + 'view',
177 + [
178 + 'label' => esc_html__( 'View', 'elementor' ),
179 + 'type' => Controls_Manager::HIDDEN,
180 + 'default' => 'traditional',
181 + ]
182 + );
183 +
273 184 $this->end_controls_section();
274 185
275 186 $this->start_controls_section(
276 187 'section_gallery_images',
@@ -282,9 +193,9 @@
282 193
283 194 $this->add_control(
284 195 'image_spacing',
285 196 [
286 - 'label' => esc_html__( 'Gap', 'elementor' ),
197 + 'label' => esc_html__( 'Spacing', 'elementor' ),
287 198 'type' => Controls_Manager::SELECT,
288 199 'options' => [
289 200 '' => esc_html__( 'Default', 'elementor' ),
290 201 'custom' => esc_html__( 'Custom', 'elementor' ),
@@ -299,21 +210,15 @@
299 210
300 211 $this->add_control(
301 212 'image_spacing_custom',
302 213 [
303 - 'label' => esc_html__( 'Custom Gap', 'elementor' ),
214 + 'label' => esc_html__( 'Image Spacing', 'elementor' ),
304 215 'type' => Controls_Manager::SLIDER,
305 - 'size_units' => [ 'px', 'em', 'rem', 'custom' ],
216 + 'show_label' => false,
306 217 'range' => [
307 218 'px' => [
308 219 'max' => 100,
309 220 ],
310 - 'em' => [
311 - 'max' => 10,
312 - ],
313 - 'rem' => [
314 - 'max' => 10,
315 - ],
316 221 ],
317 222 'default' => [
318 223 'size' => 15,
319 224 ],
@@ -354,11 +259,24 @@
354 259 'section_caption',
355 260 [
356 261 'label' => esc_html__( 'Caption', 'elementor' ),
357 262 'tab' => Controls_Manager::TAB_STYLE,
358 - 'condition' => [
359 - 'gallery_display_caption' => '',
263 + ]
264 + );
265 +
266 + $this->add_control(
267 + 'gallery_display_caption',
268 + [
269 + 'label' => esc_html__( 'Display', 'elementor' ),
270 + 'type' => Controls_Manager::SELECT,
271 + 'default' => '',
272 + 'options' => [
273 + '' => esc_html__( 'Show', 'elementor' ),
274 + 'none' => esc_html__( 'Hide', 'elementor' ),
360 275 ],
276 + 'selectors' => [
277 + '{{WRAPPER}} .gallery-item .gallery-caption' => 'display: {{VALUE}};',
278 + ],
361 279 ]
362 280 );
363 281
364 282 $this->add_responsive_control(
@@ -366,10 +284,10 @@
366 284 [
367 285 'label' => esc_html__( 'Alignment', 'elementor' ),
368 286 'type' => Controls_Manager::CHOOSE,
369 287 'options' => [
370 - 'start' => [
371 - 'title' => esc_html__( 'Start', 'elementor' ),
288 + 'left' => [
289 + 'title' => esc_html__( 'Left', 'elementor' ),
372 290 'icon' => 'eicon-text-align-left',
373 291 ],
374 292 'center' => [
375 293 'title' => esc_html__( 'Center', 'elementor' ),
@@ -374,10 +292,10 @@
374 292 'center' => [
375 293 'title' => esc_html__( 'Center', 'elementor' ),
376 294 'icon' => 'eicon-text-align-center',
377 295 ],
378 - 'end' => [
379 - 'title' => esc_html__( 'End', 'elementor' ),
296 + 'right' => [
297 + 'title' => esc_html__( 'Right', 'elementor' ),
380 298 'icon' => 'eicon-text-align-right',
381 299 ],
382 300 'justify' => [
383 301 'title' => esc_html__( 'Justified', 'elementor' ),
@@ -383,13 +301,8 @@
383 301 'title' => esc_html__( 'Justified', 'elementor' ),
384 302 'icon' => 'eicon-text-align-justify',
385 303 ],
386 304 ],
387 - 'classes' => 'elementor-control-start-end',
388 - 'selectors_dictionary' => [
389 - 'left' => is_rtl() ? 'end' : 'start',
390 - 'right' => is_rtl() ? 'start' : 'end',
391 - ],
392 305 'default' => 'center',
393 306 'selectors' => [
394 307 '{{WRAPPER}} .gallery-item .gallery-caption' => 'text-align: {{VALUE}};',
395 308 ],
@@ -432,29 +345,11 @@
432 345 Group_Control_Text_Shadow::get_type(),
433 346 [
434 347 'name' => 'caption_shadow',
435 348 'selector' => '{{WRAPPER}} .gallery-item .gallery-caption',
436 - 'condition' => [
437 - 'gallery_display_caption' => '',
438 - ],
439 349 ]
440 350 );
441 351
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 352 $this->end_controls_section();
458 353 }
459 354
460 355 /**
@@ -498,26 +393,6 @@
498 393 remove_filter( 'wp_get_attachment_link', [ $this, 'add_lightbox_data_to_image_link' ] );
499 394 ?>
500 395 </div>
501 396 <?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 397 }
523 398 }