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-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-box.php +168 -396 4.2.0-dev23.13.3 View file →
@@ -72,31 +72,9 @@
72 72 public function get_keywords() {
73 73 return [ 'image', 'photo', 'visual', 'box' ];
74 74 }
75 75
76 - protected function is_dynamic_content(): bool {
77 - return false;
78 - }
79 -
80 76 /**
81 - * Get style dependencies.
82 - *
83 - * Retrieve the list of style dependencies the widget requires.
84 - *
85 - * @since 3.24.0
86 - * @access public
87 - *
88 - * @return array Widget style dependencies.
89 - */
90 - public function get_style_depends(): array {
91 - return [ 'widget-image-box' ];
92 - }
93 -
94 - public function has_widget_inner_wrapper(): bool {
95 - return ! Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
96 - }
97 -
98 - /**
99 77 * Register image box widget controls.
100 78 *
101 79 * Adds different input fields to allow the user to change and customize the widget settings.
102 80 *
@@ -129,11 +107,9 @@
129 107 Group_Control_Image_Size::get_type(),
130 108 [
131 109 'name' => 'thumbnail', // Usage: `{name}_size` and `{name}_custom_dimension`, in this case `thumbnail_size` and `thumbnail_custom_dimension`.
132 110 'default' => 'full',
133 - 'condition' => [
134 - 'image[url]!' => '',
135 - ],
111 + 'separator' => 'none',
136 112 ]
137 113 );
138 114
139 115 $this->add_control(
@@ -159,8 +135,9 @@
159 135 'active' => true,
160 136 ],
161 137 'default' => esc_html__( 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.', 'elementor' ),
162 138 'placeholder' => esc_html__( 'Enter your description', 'elementor' ),
139 + 'separator' => 'none',
163 140 'rows' => 10,
164 141 ]
165 142 );
166 143
@@ -171,43 +148,14 @@
171 148 'type' => Controls_Manager::URL,
172 149 'dynamic' => [
173 150 'active' => true,
174 151 ],
152 + 'placeholder' => esc_html__( 'https://your-link.com', 'elementor' ),
175 153 'separator' => 'before',
176 154 ]
177 155 );
178 156
179 157 $this->add_control(
180 - 'title_size',
181 - [
182 - 'label' => esc_html__( 'Title HTML Tag', 'elementor' ),
183 - 'type' => Controls_Manager::SELECT,
184 - 'options' => [
185 - 'h1' => 'H1',
186 - 'h2' => 'H2',
187 - 'h3' => 'H3',
188 - 'h4' => 'H4',
189 - 'h5' => 'H5',
190 - 'h6' => 'H6',
191 - 'div' => 'div',
192 - 'span' => 'span',
193 - 'p' => 'p',
194 - ],
195 - 'default' => 'h3',
196 - ]
197 - );
198 -
199 - $this->end_controls_section();
200 -
201 - $this->start_controls_section(
202 - 'section_style_box',
203 - [
204 - 'label' => esc_html__( 'Box', 'elementor' ),
205 - 'tab' => Controls_Manager::TAB_STYLE,
206 - ]
207 - );
208 -
209 - $this->add_responsive_control(
210 158 'position',
211 159 [
212 160 'label' => esc_html__( 'Image Position', 'elementor' ),
213 161 'type' => Controls_Manager::CHOOSE,
@@ -227,81 +175,54 @@
227 175 ],
228 176 ],
229 177 'prefix_class' => 'elementor-position-',
230 178 'toggle' => false,
231 - 'condition' => [
232 - 'image[url]!' => '',
233 - ],
234 179 ]
235 180 );
236 181
237 - $this->add_responsive_control(
238 - 'content_vertical_alignment',
182 + $this->add_control(
183 + 'title_size',
239 184 [
240 - 'label' => esc_html__( 'Vertical Alignment', 'elementor' ),
241 - 'type' => Controls_Manager::CHOOSE,
185 + 'label' => esc_html__( 'Title HTML Tag', 'elementor' ),
186 + 'type' => Controls_Manager::SELECT,
242 187 'options' => [
243 - 'top' => [
244 - 'title' => esc_html__( 'Top', 'elementor' ),
245 - 'icon' => 'eicon-v-align-top',
246 - ],
247 - 'middle' => [
248 - 'title' => esc_html__( 'Middle', 'elementor' ),
249 - 'icon' => 'eicon-v-align-middle',
250 - ],
251 - 'bottom' => [
252 - 'title' => esc_html__( 'Bottom', 'elementor' ),
253 - 'icon' => 'eicon-v-align-bottom',
254 - ],
188 + 'h1' => 'H1',
189 + 'h2' => 'H2',
190 + 'h3' => 'H3',
191 + 'h4' => 'H4',
192 + 'h5' => 'H5',
193 + 'h6' => 'H6',
194 + 'div' => 'div',
195 + 'span' => 'span',
196 + 'p' => 'p',
255 197 ],
256 - 'default' => 'top',
257 - 'toggle' => false,
258 - 'prefix_class' => 'elementor-vertical-align-',
259 - 'condition' => [
260 - 'position!' => 'top',
261 - ],
198 + 'default' => 'h3',
262 199 ]
263 200 );
264 201
265 - $this->add_responsive_control(
266 - 'text_align',
202 + $this->add_control(
203 + 'view',
267 204 [
268 - 'label' => esc_html__( 'Alignment', 'elementor' ),
269 - 'type' => Controls_Manager::CHOOSE,
270 - 'options' => [
271 - 'start' => [
272 - 'title' => esc_html__( 'Start', 'elementor' ),
273 - 'icon' => 'eicon-text-align-left',
274 - ],
275 - 'center' => [
276 - 'title' => esc_html__( 'Center', 'elementor' ),
277 - 'icon' => 'eicon-text-align-center',
278 - ],
279 - 'end' => [
280 - 'title' => esc_html__( 'End', 'elementor' ),
281 - 'icon' => 'eicon-text-align-right',
282 - ],
283 - 'justify' => [
284 - 'title' => esc_html__( 'Justified', 'elementor' ),
285 - 'icon' => 'eicon-text-align-justify',
286 - ],
287 - ],
288 - 'classes' => 'elementor-control-start-end',
289 - 'selectors_dictionary' => [
290 - 'left' => is_rtl() ? 'end' : 'start',
291 - 'right' => is_rtl() ? 'start' : 'end',
292 - ],
293 - 'selectors' => [
294 - '{{WRAPPER}} .elementor-image-box-wrapper' => 'text-align: {{VALUE}};',
295 - ],
296 - 'separator' => 'after',
205 + 'label' => esc_html__( 'View', 'elementor' ),
206 + 'type' => Controls_Manager::HIDDEN,
207 + 'default' => 'traditional',
297 208 ]
298 209 );
299 210
211 + $this->end_controls_section();
212 +
213 + $this->start_controls_section(
214 + 'section_style_image',
215 + [
216 + 'label' => esc_html__( 'Image', 'elementor' ),
217 + 'tab' => Controls_Manager::TAB_STYLE,
218 + ]
219 + );
220 +
300 221 $this->add_responsive_control(
301 222 'image_space',
302 223 [
303 - 'label' => esc_html__( 'Image Spacing', 'elementor' ),
224 + 'label' => esc_html__( 'Spacing', 'elementor' ),
304 225 'type' => Controls_Manager::SLIDER,
305 226 'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ],
306 227 'default' => [
307 228 'size' => 15,
@@ -307,8 +228,9 @@
307 228 'size' => 15,
308 229 ],
309 230 'range' => [
310 231 'px' => [
232 + 'min' => 0,
311 233 'max' => 100,
312 234 ],
313 235 ],
314 236 'selectors' => [
@@ -316,56 +238,15 @@
316 238 '{{WRAPPER}}.elementor-position-left .elementor-image-box-img' => 'margin-right: {{SIZE}}{{UNIT}};',
317 239 '{{WRAPPER}}.elementor-position-top .elementor-image-box-img' => 'margin-bottom: {{SIZE}}{{UNIT}};',
318 240 '(mobile){{WRAPPER}} .elementor-image-box-img' => 'margin-bottom: {{SIZE}}{{UNIT}};',
319 241 ],
320 - 'condition' => [
321 - 'image[url]!' => '',
322 - ],
323 242 ]
324 243 );
325 244
326 245 $this->add_responsive_control(
327 - 'title_bottom_space',
328 - [
329 - 'label' => esc_html__( 'Content Spacing', 'elementor' ),
330 - 'type' => Controls_Manager::SLIDER,
331 - 'size_units' => [ 'px', 'em', 'rem', 'custom' ],
332 - 'range' => [
333 - 'px' => [
334 - 'max' => 100,
335 - ],
336 - 'em' => [
337 - 'min' => 0,
338 - 'max' => 10,
339 - ],
340 - 'rem' => [
341 - 'min' => 0,
342 - 'max' => 10,
343 - ],
344 - ],
345 - 'selectors' => [
346 - '{{WRAPPER}} .elementor-image-box-title' => 'margin-bottom: {{SIZE}}{{UNIT}};',
347 - ],
348 - ]
349 - );
350 -
351 - $this->end_controls_section();
352 -
353 - $this->start_controls_section(
354 - 'section_style_image',
355 - [
356 - 'label' => esc_html__( 'Image', 'elementor' ),
357 - 'tab' => Controls_Manager::TAB_STYLE,
358 - 'condition' => [
359 - 'image[url]!' => '',
360 - ],
361 - ]
362 - );
363 -
364 - $this->add_responsive_control(
365 246 'image_size',
366 247 [
367 - 'label' => esc_html__( 'Width', 'elementor' ),
248 + 'label' => esc_html__( 'Width', 'elementor' ) . ' (%)',
368 249 'type' => Controls_Manager::SLIDER,
369 250 'default' => [
370 251 'size' => 30,
371 252 'unit' => '%',
@@ -375,9 +256,9 @@
375 256 ],
376 257 'mobile_default' => [
377 258 'unit' => '%',
378 259 ],
379 - 'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ],
260 + 'size_units' => [ '%' ],
380 261 'range' => [
381 262 '%' => [
382 263 'min' => 5,
383 264 'max' => 100,
@@ -388,68 +269,8 @@
388 269 ],
389 270 ]
390 271 );
391 272
392 - $this->add_responsive_control(
393 - 'image_height',
394 - [
395 - 'label' => esc_html__( 'Height', 'elementor' ),
396 - 'type' => Controls_Manager::SLIDER,
397 - 'size_units' => [ 'px', '%', 'em', 'rem', 'vh', 'custom' ],
398 - 'selectors' => [
399 - '{{WRAPPER}} .elementor-image-box-img img' => 'height: {{SIZE}}{{UNIT}};',
400 - ],
401 - ]
402 - );
403 -
404 - $this->add_responsive_control(
405 - 'image_object_fit',
406 - [
407 - 'label' => esc_html__( 'Object Fit', 'elementor' ),
408 - 'type' => Controls_Manager::SELECT,
409 - 'options' => [
410 - '' => esc_html__( 'Default', 'elementor' ),
411 - 'fill' => esc_html__( 'Fill', 'elementor' ),
412 - 'cover' => esc_html__( 'Cover', 'elementor' ),
413 - 'contain' => esc_html__( 'Contain', 'elementor' ),
414 - 'scale-down' => esc_html__( 'Scale Down', 'elementor' ),
415 - ],
416 - 'condition' => [
417 - 'image_height[size]!' => '',
418 - ],
419 - 'selectors' => [
420 - '{{WRAPPER}} .elementor-image-box-img img' => 'object-fit: {{VALUE}};',
421 - ],
422 - ]
423 - );
424 -
425 - $this->add_responsive_control(
426 - 'image_object_position',
427 - [
428 - 'label' => esc_html__( 'Object Position', 'elementor' ),
429 - 'type' => Controls_Manager::SELECT,
430 - 'options' => [
431 - 'center center' => esc_html__( 'Center Center', 'elementor' ),
432 - 'center left' => esc_html__( 'Center Left', 'elementor' ),
433 - 'center right' => esc_html__( 'Center Right', 'elementor' ),
434 - 'top center' => esc_html__( 'Top Center', 'elementor' ),
435 - 'top left' => esc_html__( 'Top Left', 'elementor' ),
436 - 'top right' => esc_html__( 'Top Right', 'elementor' ),
437 - 'bottom center' => esc_html__( 'Bottom Center', 'elementor' ),
438 - 'bottom left' => esc_html__( 'Bottom Left', 'elementor' ),
439 - 'bottom right' => esc_html__( 'Bottom Right', 'elementor' ),
440 - ],
441 - 'default' => 'center center',
442 - 'selectors' => [
443 - '{{WRAPPER}} .elementor-image-box-img img' => 'object-position: {{VALUE}};',
444 - ],
445 - 'condition' => [
446 - 'image_height[size]!' => '',
447 - 'image_object_fit' => [ 'cover', 'contain', 'scale-down' ],
448 - ],
449 - ]
450 - );
451 -
452 273 $this->add_group_control(
453 274 Group_Control_Border::get_type(),
454 275 [
455 276 'name' => 'image_border',
@@ -463,8 +284,9 @@
463 284 [
464 285 'label' => esc_html__( 'Border Radius', 'elementor' ),
465 286 'type' => Controls_Manager::SLIDER,
466 287 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
288 + 'separator' => 'after',
467 289 'selectors' => [
468 290 '{{WRAPPER}} .elementor-image-box-img img' => 'border-radius: {{SIZE}}{{UNIT}};',
469 291 ],
470 292 ]
@@ -469,28 +291,19 @@
469 291 ],
470 292 ]
471 293 );
472 294
473 - $this->add_group_control(
474 - Group_Control_Box_Shadow::get_type(),
475 - [
476 - 'name' => 'image_box_shadow',
477 - 'selector' => '{{WRAPPER}} .elementor-image-box-img img',
478 - ]
479 - );
480 -
481 295 $this->add_control(
482 - 'separator_panel_style',
296 + 'hover_animation',
483 297 [
484 - 'type' => Controls_Manager::DIVIDER,
485 - 'style' => 'thick',
298 + 'label' => esc_html__( 'Hover Animation', 'elementor' ),
299 + 'type' => Controls_Manager::HOVER_ANIMATION,
486 300 ]
487 301 );
488 302
489 303 $this->start_controls_tabs( 'image_effects' );
490 304
491 - $this->start_controls_tab(
492 - 'normal',
305 + $this->start_controls_tab( 'normal',
493 306 [
494 307 'label' => esc_html__( 'Normal', 'elementor' ),
495 308 ]
496 309 );
@@ -520,12 +333,31 @@
520 333 ],
521 334 ]
522 335 );
523 336
337 + $this->add_control(
338 + 'background_hover_transition',
339 + [
340 + 'label' => esc_html__( 'Transition Duration', 'elementor' ),
341 + 'type' => Controls_Manager::SLIDER,
342 + 'default' => [
343 + 'size' => 0.3,
344 + ],
345 + 'range' => [
346 + 'px' => [
347 + 'max' => 3,
348 + 'step' => 0.1,
349 + ],
350 + ],
351 + 'selectors' => [
352 + '{{WRAPPER}} .elementor-image-box-img img' => 'transition-duration: {{SIZE}}s',
353 + ],
354 + ]
355 + );
356 +
524 357 $this->end_controls_tab();
525 358
526 - $this->start_controls_tab(
527 - 'hover',
359 + $this->start_controls_tab( 'hover',
528 360 [
529 361 'label' => esc_html__( 'Hover', 'elementor' ),
530 362 ]
531 363 );
@@ -555,57 +387,104 @@
555 387 ],
556 388 ]
557 389 );
558 390
559 - $this->add_control(
560 - 'background_hover_transition',
391 + $this->end_controls_tab();
392 +
393 + $this->end_controls_tabs();
394 +
395 + $this->end_controls_section();
396 +
397 + $this->start_controls_section(
398 + 'section_style_content',
561 399 [
562 - 'label' => esc_html__( 'Transition Duration', 'elementor' ) . ' (s)',
563 - 'type' => Controls_Manager::SLIDER,
564 - 'default' => [
565 - 'size' => 0.3,
566 - ],
567 - 'range' => [
568 - 'px' => [
569 - 'min' => 0,
570 - 'max' => 3,
571 - 'step' => 0.1,
400 + 'label' => esc_html__( 'Content', 'elementor' ),
401 + 'tab' => Controls_Manager::TAB_STYLE,
402 + ]
403 + );
404 +
405 + $this->add_responsive_control(
406 + 'text_align',
407 + [
408 + 'label' => esc_html__( 'Alignment', 'elementor' ),
409 + 'type' => Controls_Manager::CHOOSE,
410 + 'options' => [
411 + 'left' => [
412 + 'title' => esc_html__( 'Left', 'elementor' ),
413 + 'icon' => 'eicon-text-align-left',
572 414 ],
415 + 'center' => [
416 + 'title' => esc_html__( 'Center', 'elementor' ),
417 + 'icon' => 'eicon-text-align-center',
418 + ],
419 + 'right' => [
420 + 'title' => esc_html__( 'Right', 'elementor' ),
421 + 'icon' => 'eicon-text-align-right',
422 + ],
423 + 'justify' => [
424 + 'title' => esc_html__( 'Justified', 'elementor' ),
425 + 'icon' => 'eicon-text-align-justify',
426 + ],
573 427 ],
574 428 'selectors' => [
575 - '{{WRAPPER}} .elementor-image-box-img img' => 'transition-duration: {{SIZE}}s',
429 + '{{WRAPPER}} .elementor-image-box-wrapper' => 'text-align: {{VALUE}};',
576 430 ],
577 431 ]
578 432 );
579 433
580 434 $this->add_control(
581 - 'hover_animation',
435 + 'content_vertical_alignment',
582 436 [
583 - 'label' => esc_html__( 'Hover Animation', 'elementor' ),
584 - 'type' => Controls_Manager::HOVER_ANIMATION,
437 + 'label' => esc_html__( 'Vertical Alignment', 'elementor' ),
438 + 'type' => Controls_Manager::SELECT,
439 + 'options' => [
440 + 'top' => esc_html__( 'Top', 'elementor' ),
441 + 'middle' => esc_html__( 'Middle', 'elementor' ),
442 + 'bottom' => esc_html__( 'Bottom', 'elementor' ),
443 + ],
444 + 'default' => 'top',
445 + 'prefix_class' => 'elementor-vertical-align-',
585 446 ]
586 447 );
587 448
588 - $this->end_controls_tab();
449 + $this->add_control(
450 + 'heading_title',
451 + [
452 + 'label' => esc_html__( 'Title', 'elementor' ),
453 + 'type' => Controls_Manager::HEADING,
454 + 'separator' => 'before',
455 + ]
456 + );
589 457
590 - $this->end_controls_tabs();
591 -
592 - $this->end_controls_section();
593 -
594 - $this->start_controls_section(
595 - 'section_style_content',
458 + $this->add_responsive_control(
459 + 'title_bottom_space',
596 460 [
597 - 'label' => esc_html__( 'Content', 'elementor' ),
598 - 'tab' => Controls_Manager::TAB_STYLE,
461 + 'label' => esc_html__( 'Spacing', 'elementor' ),
462 + 'type' => Controls_Manager::SLIDER,
463 + 'range' => [
464 + 'px' => [
465 + 'min' => 0,
466 + 'max' => 100,
467 + ],
468 + ],
469 + 'selectors' => [
470 + '{{WRAPPER}} .elementor-image-box-title' => 'margin-bottom: {{SIZE}}{{UNIT}};',
471 + ],
599 472 ]
600 473 );
601 474
602 475 $this->add_control(
603 - 'heading_title',
476 + 'title_color',
604 477 [
605 - 'label' => esc_html__( 'Title', 'elementor' ),
606 - 'type' => Controls_Manager::HEADING,
607 - 'separator' => 'before',
478 + 'label' => esc_html__( 'Color', 'elementor' ),
479 + 'type' => Controls_Manager::COLOR,
480 + 'default' => '',
481 + 'selectors' => [
482 + '{{WRAPPER}} .elementor-image-box-title' => 'color: {{VALUE}};',
483 + ],
484 + 'global' => [
485 + 'default' => Global_Colors::COLOR_PRIMARY,
486 + ],
608 487 ]
609 488 );
610 489
611 490 $this->add_group_control(
@@ -634,85 +513,32 @@
634 513 'selector' => '{{WRAPPER}} .elementor-image-box-title',
635 514 ]
636 515 );
637 516
638 - $this->start_controls_tabs( 'image_box_title_colors' );
639 -
640 - $this->start_controls_tab(
641 - 'image_box_title_colors_normal',
642 - [
643 - 'label' => esc_html__( 'Normal', 'elementor' ),
644 - ]
645 - );
646 -
647 517 $this->add_control(
648 - 'title_color',
518 + 'heading_description',
649 519 [
650 - 'label' => esc_html__( 'Color', 'elementor' ),
651 - 'type' => Controls_Manager::COLOR,
652 - 'default' => '',
653 - 'selectors' => [
654 - '{{WRAPPER}} .elementor-image-box-title' => 'color: {{VALUE}};',
655 - ],
656 - 'global' => [
657 - 'default' => Global_Colors::COLOR_PRIMARY,
658 - ],
520 + 'label' => esc_html__( 'Description', 'elementor' ),
521 + 'type' => Controls_Manager::HEADING,
522 + 'separator' => 'before',
659 523 ]
660 524 );
661 525
662 - $this->end_controls_tab();
663 -
664 - $this->start_controls_tab(
665 - 'image_box_title_colors_hover',
666 - [
667 - 'label' => esc_html__( 'Hover', 'elementor' ),
668 - ]
669 - );
670 -
671 526 $this->add_control(
672 - 'hover_title_color',
527 + 'description_color',
673 528 [
674 529 'label' => esc_html__( 'Color', 'elementor' ),
675 530 'type' => Controls_Manager::COLOR,
676 531 'default' => '',
677 532 'selectors' => [
678 - '{{WRAPPER}}:has(:hover) .elementor-image-box-title,
679 - {{WRAPPER}}:has(:focus) .elementor-image-box-title' => 'color: {{VALUE}};',
533 + '{{WRAPPER}} .elementor-image-box-description' => 'color: {{VALUE}};',
680 534 ],
681 535 'global' => [
682 - 'default' => Global_Colors::COLOR_PRIMARY,
536 + 'default' => Global_Colors::COLOR_TEXT,
683 537 ],
684 538 ]
685 539 );
686 540
687 - $this->add_control(
688 - 'hover_title_color_transition_duration',
689 - [
690 - 'label' => esc_html__( 'Transition Duration', 'elementor' ),
691 - 'type' => Controls_Manager::SLIDER,
692 - 'size_units' => [ 's', 'ms', 'custom' ],
693 - 'default' => [
694 - 'unit' => 's',
695 - ],
696 - 'selectors' => [
697 - '{{WRAPPER}} .elementor-image-box-title' => 'transition-duration: {{SIZE}}{{UNIT}};',
698 - ],
699 - ]
700 - );
701 -
702 - $this->end_controls_tab();
703 -
704 - $this->end_controls_tabs();
705 -
706 - $this->add_control(
707 - 'heading_description',
708 - [
709 - 'label' => esc_html__( 'Description', 'elementor' ),
710 - 'type' => Controls_Manager::HEADING,
711 - 'separator' => 'before',
712 - ]
713 - );
714 -
715 541 $this->add_group_control(
716 542 Group_Control_Typography::get_type(),
717 543 [
718 544 'name' => 'description_typography',
@@ -730,23 +556,8 @@
730 556 'selector' => '{{WRAPPER}} .elementor-image-box-description',
731 557 ]
732 558 );
733 559
734 - $this->add_control(
735 - 'description_color',
736 - [
737 - 'label' => esc_html__( 'Color', 'elementor' ),
738 - 'type' => Controls_Manager::COLOR,
739 - 'default' => '',
740 - 'selectors' => [
741 - '{{WRAPPER}} .elementor-image-box-description' => 'color: {{VALUE}};',
742 - ],
743 - 'global' => [
744 - 'default' => Global_Colors::COLOR_TEXT,
745 - ],
746 - ]
747 - );
748 -
749 560 $this->end_controls_section();
750 561 }
751 562
752 563 /**
@@ -759,18 +570,10 @@
759 570 */
760 571 protected function render() {
761 572 $settings = $this->get_settings_for_display();
762 573
763 - $description_text = wp_kses_post( $settings['description_text'] );
764 - $title_text = wp_kses_post( $settings['title_text'] );
574 + $has_content = ! Utils::is_empty( $settings['title_text'] ) || ! Utils::is_empty( $settings['description_text'] );
765 575
766 - $has_image = ! empty( $settings['image']['url'] );
767 - $has_content = ! Utils::is_empty( $title_text ) || ! Utils::is_empty( $description_text );
768 -
769 - if ( ! $has_image && ! $has_content ) {
770 - return;
771 - }
772 -
773 576 $html = '<div class="elementor-image-box-wrapper">';
774 577
775 578 if ( ! empty( $settings['link']['url'] ) ) {
776 579 $this->add_link_attributes( 'link', $settings['link'] );
@@ -775,14 +578,14 @@
775 578 if ( ! empty( $settings['link']['url'] ) ) {
776 579 $this->add_link_attributes( 'link', $settings['link'] );
777 580 }
778 581
779 - if ( $has_image ) {
582 + if ( ! empty( $settings['image']['url'] ) ) {
780 583
781 584 $image_html = wp_kses_post( Group_Control_Image_Size::get_attachment_image_html( $settings, 'thumbnail', 'image' ) );
782 585
783 586 if ( ! empty( $settings['link']['url'] ) ) {
784 - $image_html = '<a ' . $this->get_render_attribute_string( 'link' ) . ' tabindex="-1">' . $image_html . '</a>';
587 + $image_html = '<a ' . $this->get_render_attribute_string( 'link' ) . '>' . $image_html . '</a>';
785 588 }
786 589
787 590 $html .= '<figure class="elementor-image-box-img">' . $image_html . '</figure>';
788 591 }
@@ -789,27 +592,28 @@
789 592
790 593 if ( $has_content ) {
791 594 $html .= '<div class="elementor-image-box-content">';
792 595
793 - if ( ! Utils::is_empty( $title_text ) ) {
794 - $title_html = $title_text;
596 + if ( ! Utils::is_empty( $settings['title_text'] ) ) {
795 597 $this->add_render_attribute( 'title_text', 'class', 'elementor-image-box-title' );
796 598
797 599 $this->add_inline_editing_attributes( 'title_text', 'none' );
798 600
601 + $title_html = $settings['title_text'];
602 +
799 603 if ( ! empty( $settings['link']['url'] ) ) {
800 - $title_html = '<a ' . $this->get_render_attribute_string( 'link' ) . '>' . $title_text . '</a>';
604 + $title_html = '<a ' . $this->get_render_attribute_string( 'link' ) . '>' . $title_html . '</a>';
801 605 }
802 606
803 607 $html .= sprintf( '<%1$s %2$s>%3$s</%1$s>', Utils::validate_html_tag( $settings['title_size'] ), $this->get_render_attribute_string( 'title_text' ), $title_html );
804 608 }
805 609
806 - if ( ! Utils::is_empty( $description_text ) ) {
610 + if ( ! Utils::is_empty( $settings['description_text'] ) ) {
807 611 $this->add_render_attribute( 'description_text', 'class', 'elementor-image-box-description' );
808 612
809 613 $this->add_inline_editing_attributes( 'description_text' );
810 614
811 - $html .= sprintf( '<p %1$s>%2$s</p>', $this->get_render_attribute_string( 'description_text' ), $description_text );
615 + $html .= sprintf( '<p %1$s>%2$s</p>', $this->get_render_attribute_string( 'description_text' ), $settings['description_text'] );
812 616 }
813 617
814 618 $html .= '</div>';
815 619 }
@@ -829,21 +633,11 @@
829 633 */
830 634 protected function content_template() {
831 635 ?>
832 636 <#
833 - const titleText = elementor.helpers.sanitize( settings.title_text, { ALLOW_DATA_ATTR: false } )
834 - const descriptionText = elementor.helpers.sanitize( settings.description_text, { ALLOW_DATA_ATTR: false } )
835 -
836 - var hasImage = !! settings.image.url;
837 - var hasContent = !! ( titleText || descriptionText );
838 -
839 - if ( ! hasImage && ! hasContent ) {
840 - return;
841 - }
842 -
843 637 var html = '<div class="elementor-image-box-wrapper">';
844 638
845 - if ( hasImage ) {
639 + if ( settings.image.url ) {
846 640 var image = {
847 641 id: settings.image.id,
848 642 url: settings.image.url,
849 643 size: settings.thumbnail_size,
@@ -852,25 +646,28 @@
852 646 };
853 647
854 648 var image_url = elementor.imagesManager.getImageUrl( image );
855 649
856 - var imageHtml = '<img src="' + _.escape( image_url ) + '" class="elementor-animation-' + _.escape( settings.hover_animation ) + '" />';
650 + var imageHtml = '<img src="' + image_url + '" class="elementor-animation-' + settings.hover_animation + '" />';
857 651
858 - if ( settings.link?.url ) {
859 - imageHtml = '<a href="' + elementor.helpers.sanitizeUrl( settings.link?.url ) + '" tabindex="-1">' + imageHtml + '</a>';
652 + if ( settings.link.url ) {
653 + imageHtml = '<a href="' + settings.link.url + '">' + imageHtml + '</a>';
860 654 }
861 655
862 656 html += '<figure class="elementor-image-box-img">' + imageHtml + '</figure>';
863 657 }
864 658
659 + var hasContent = !! ( settings.title_text || settings.description_text );
660 +
865 661 if ( hasContent ) {
866 662 html += '<div class="elementor-image-box-content">';
867 663
868 - if ( titleText ) {
869 - var titleSizeTag = elementor.helpers.validateHTMLTag( settings.title_size );
664 + if ( settings.title_text ) {
665 + var title_html = settings.title_text,
666 + titleSizeTag = elementor.helpers.validateHTMLTag( settings.title_size );
870 667
871 - if ( settings.link?.url ) {
872 - title_html = '<a href="' + elementor.helpers.sanitizeUrl( settings.link?.url ) + '">' + titleText + '</a>';
668 + if ( settings.link.url ) {
669 + title_html = '<a href="' + settings.link.url + '">' + title_html + '</a>';
873 670 }
874 671
875 672 view.addRenderAttribute( 'title_text', 'class', 'elementor-image-box-title' );
876 673
@@ -875,17 +672,17 @@
875 672 view.addRenderAttribute( 'title_text', 'class', 'elementor-image-box-title' );
876 673
877 674 view.addInlineEditingAttributes( 'title_text', 'none' );
878 675
879 - html += '<' + titleSizeTag + ' ' + view.getRenderAttributeString( 'title_text' ) + '>' + titleText + '</' + titleSizeTag + '>';
676 + html += '<' + titleSizeTag + ' ' + view.getRenderAttributeString( 'title_text' ) + '>' + title_html + '</' + titleSizeTag + '>';
880 677 }
881 678
882 - if ( descriptionText ) {
679 + if ( settings.description_text ) {
883 680 view.addRenderAttribute( 'description_text', 'class', 'elementor-image-box-description' );
884 681
885 682 view.addInlineEditingAttributes( 'description_text' );
886 683
887 - html += '<p ' + view.getRenderAttributeString( 'description_text' ) + '>' + descriptionText + '</p>';
684 + html += '<p ' + view.getRenderAttributeString( 'description_text' ) + '>' + settings.description_text + '</p>';
888 685 }
889 686
890 687 html += '</div>';
891 688 }
@@ -894,31 +691,6 @@
894 691
895 692 print( html );
896 693 #>
897 694 <?php
898 - }
899 -
900 - public function render_markdown(): string {
901 - $settings = $this->get_settings_for_display();
902 - $title = Utils::html_to_plain_text( $settings['title_text'] ?? '' );
903 - $description = Utils::html_to_plain_text( $settings['description_text'] ?? '' );
904 - $image_url = $settings['image']['url'] ?? '';
905 - if ( empty( $title ) && empty( $description ) && empty( $image_url ) ) {
906 - return '';
907 - }
908 - $parts = [];
909 - if ( ! empty( $image_url ) ) {
910 - $parts[] = '![' . $title . '](' . esc_url( $image_url ) . ')';
911 - }
912 - if ( ! empty( $title ) ) {
913 - if ( ! empty( $settings['link']['url'] ) ) {
914 - $parts[] = '### [' . $title . '](' . esc_url( $settings['link']['url'] ) . ')';
915 - } else {
916 - $parts[] = '### ' . $title;
917 - }
918 - }
919 - if ( ! empty( $description ) ) {
920 - $parts[] = $description;
921 - }
922 - return implode( "\n\n", $parts );
923 695 }
924 696 }