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/icon-box.php +184 -414 4.2.0-dev23.13.3 View file →
@@ -72,31 +72,9 @@
72 72 public function get_keywords() {
73 73 return [ 'icon box', 'icon' ];
74 74 }
75 75
76 - protected function is_dynamic_content(): bool {
77 - return false;
78 - }
79 -
80 - public function has_widget_inner_wrapper(): bool {
81 - return ! Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
82 - }
83 -
84 76 /**
85 - * Get style dependencies.
86 - *
87 - * Retrieve the list of style dependencies the widget requires.
88 - *
89 - * @since 3.24.0
90 - * @access public
91 - *
92 - * @return array Widget style dependencies.
93 - */
94 - public function get_style_depends(): array {
95 - return [ 'widget-icon-box' ];
96 - }
97 -
98 - /**
99 77 * Register icon box widget controls.
100 78 *
101 79 * Adds different input fields to allow the user to change and customize the widget settings.
102 80 *
@@ -135,11 +113,8 @@
135 113 'framed' => esc_html__( 'Framed', 'elementor' ),
136 114 ],
137 115 'default' => 'default',
138 116 'prefix_class' => 'elementor-view-',
139 - 'condition' => [
140 - 'selected_icon[value]!' => '',
141 - ],
142 117 ]
143 118 );
144 119
145 120 $this->add_control(
@@ -147,11 +122,10 @@
147 122 [
148 123 'label' => esc_html__( 'Shape', 'elementor' ),
149 124 'type' => Controls_Manager::SELECT,
150 125 'options' => [
126 + 'circle' => esc_html__( 'Circle', 'elementor' ),
151 127 'square' => esc_html__( 'Square', 'elementor' ),
152 - 'rounded' => esc_html__( 'Rounded', 'elementor' ),
153 - 'circle' => esc_html__( 'Circle', 'elementor' ),
154 128 ],
155 129 'default' => 'circle',
156 130 'condition' => [
157 131 'view!' => 'default',
@@ -196,205 +170,67 @@
196 170 'type' => Controls_Manager::URL,
197 171 'dynamic' => [
198 172 'active' => true,
199 173 ],
174 + 'placeholder' => esc_html__( 'https://your-link.com', 'elementor' ),
200 175 'separator' => 'before',
201 176 ]
202 177 );
203 178
204 - $this->add_control(
205 - 'title_size',
206 - [
207 - 'label' => esc_html__( 'Title HTML Tag', 'elementor' ),
208 - 'type' => Controls_Manager::SELECT,
209 - 'options' => [
210 - 'h1' => 'H1',
211 - 'h2' => 'H2',
212 - 'h3' => 'H3',
213 - 'h4' => 'H4',
214 - 'h5' => 'H5',
215 - 'h6' => 'H6',
216 - 'div' => 'div',
217 - 'span' => 'span',
218 - 'p' => 'p',
219 - ],
220 - 'default' => 'h3',
221 - ]
222 - );
223 -
224 - $this->end_controls_section();
225 -
226 - $this->start_controls_section(
227 - 'section_style_box',
228 - [
229 - 'label' => esc_html__( 'Box', 'elementor' ),
230 - 'tab' => Controls_Manager::TAB_STYLE,
231 - ]
232 - );
233 -
234 179 $this->add_responsive_control(
235 180 'position',
236 181 [
237 182 'label' => esc_html__( 'Icon Position', 'elementor' ),
238 183 'type' => Controls_Manager::CHOOSE,
239 - 'default' => 'block-start',
240 - 'mobile_default' => 'block-start',
184 + 'mobile_default' => 'top',
241 185 'options' => [
242 - 'inline-start' => [
243 - 'title' => esc_html__( 'Start', 'elementor' ),
186 + 'left' => [
187 + 'title' => esc_html__( 'Left', 'elementor' ),
244 188 'icon' => 'eicon-h-align-left',
245 189 ],
246 - 'inline-end' => [
247 - 'title' => esc_html__( 'End', 'elementor' ),
248 - 'icon' => 'eicon-h-align-right',
249 - ],
250 - 'block-start' => [
190 + 'top' => [
251 191 'title' => esc_html__( 'Top', 'elementor' ),
252 192 'icon' => 'eicon-v-align-top',
253 193 ],
254 - 'block-end' => [
255 - 'title' => esc_html__( 'Bottom', 'elementor' ),
256 - 'icon' => 'eicon-v-align-bottom',
194 + 'right' => [
195 + 'title' => esc_html__( 'Right', 'elementor' ),
196 + 'icon' => 'eicon-h-align-right',
257 197 ],
258 198 ],
259 - 'classes' => 'elementor-control-start-end',
260 - 'classes_dictionary' => [
261 - 'left' => is_rtl() ? 'inline-end' : 'inline-start',
262 - 'right' => is_rtl() ? 'inline-start' : 'inline-end',
263 - 'top' => 'block-start',
264 - 'bottom' => 'block-end',
265 - ],
266 199 'prefix_class' => 'elementor%s-position-',
267 - 'condition' => [
268 - 'selected_icon[value]!' => '',
269 - ],
270 - ]
271 - );
272 -
273 - $this->add_responsive_control(
274 - 'content_vertical_alignment',
275 - [
276 - 'label' => esc_html__( 'Vertical Alignment', 'elementor' ),
277 - 'type' => Controls_Manager::CHOOSE,
278 - 'options' => [
279 - 'top' => [
280 - 'title' => esc_html__( 'Top', 'elementor' ),
281 - 'icon' => 'eicon-v-align-top',
200 + 'conditions' => [
201 + 'relation' => 'or',
202 + 'terms' => [
203 + [
204 + 'name' => 'selected_icon[value]',
205 + 'operator' => '!=',
206 + 'value' => '',
207 + ],
282 208 ],
283 - 'middle' => [
284 - 'title' => esc_html__( 'Middle', 'elementor' ),
285 - 'icon' => 'eicon-v-align-middle',
286 - ],
287 - 'bottom' => [
288 - 'title' => esc_html__( 'Bottom', 'elementor' ),
289 - 'icon' => 'eicon-v-align-bottom',
290 - ],
291 209 ],
292 - 'default' => 'top',
293 - 'selectors_dictionary' => [
294 - 'top' => 'start',
295 - 'middle' => 'center',
296 - 'bottom' => 'end',
297 - ],
298 - 'selectors' => [
299 - '{{WRAPPER}} .elementor-icon-box-wrapper' => 'align-items: {{VALUE}};',
300 - ],
301 - 'condition' => [
302 - 'selected_icon[value]!' => '',
303 - 'position' => [ 'left', 'right', 'inline-start', 'inline-end' ],
304 - ],
305 210 ]
306 211 );
307 212
308 - $this->add_responsive_control(
309 - 'text_align',
213 + $this->add_control(
214 + 'title_size',
310 215 [
311 - 'label' => esc_html__( 'Alignment', 'elementor' ),
312 - 'type' => Controls_Manager::CHOOSE,
216 + 'label' => esc_html__( 'Title HTML Tag', 'elementor' ),
217 + 'type' => Controls_Manager::SELECT,
313 218 'options' => [
314 - 'start' => [
315 - 'title' => esc_html__( 'Start', 'elementor' ),
316 - 'icon' => 'eicon-text-align-left',
317 - ],
318 - 'center' => [
319 - 'title' => esc_html__( 'Center', 'elementor' ),
320 - 'icon' => 'eicon-text-align-center',
321 - ],
322 - 'end' => [
323 - 'title' => esc_html__( 'End', 'elementor' ),
324 - 'icon' => 'eicon-text-align-right',
325 - ],
326 - 'justify' => [
327 - 'title' => esc_html__( 'Justified', 'elementor' ),
328 - 'icon' => 'eicon-text-align-justify',
329 - ],
219 + 'h1' => 'H1',
220 + 'h2' => 'H2',
221 + 'h3' => 'H3',
222 + 'h4' => 'H4',
223 + 'h5' => 'H5',
224 + 'h6' => 'H6',
225 + 'div' => 'div',
226 + 'span' => 'span',
227 + 'p' => 'p',
330 228 ],
331 - 'classes' => 'elementor-control-start-end',
332 - 'selectors_dictionary' => [
333 - 'left' => is_rtl() ? 'end' : 'start',
334 - 'right' => is_rtl() ? 'start' : 'end',
335 - ],
336 - 'selectors' => [
337 - '{{WRAPPER}} .elementor-icon-box-wrapper' => 'text-align: {{VALUE}};',
338 - ],
339 - 'separator' => 'after',
229 + 'default' => 'h3',
340 230 ]
341 231 );
342 232
343 - $this->add_responsive_control(
344 - 'icon_space',
345 - [
346 - 'label' => esc_html__( 'Icon Spacing', 'elementor' ),
347 - 'type' => Controls_Manager::SLIDER,
348 - 'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ],
349 - 'default' => [
350 - 'size' => 15,
351 - ],
352 - 'range' => [
353 - 'px' => [
354 - 'max' => 100,
355 - ],
356 - 'em' => [
357 - 'max' => 10,
358 - ],
359 - 'rem' => [
360 - 'max' => 10,
361 - ],
362 - ],
363 - 'selectors' => [
364 - '{{WRAPPER}} .elementor-icon-box-wrapper' => 'gap: {{SIZE}}{{UNIT}};',
365 - ],
366 - 'condition' => [
367 - 'selected_icon[value]!' => '',
368 - ],
369 - ]
370 - );
371 -
372 - $this->add_responsive_control(
373 - 'title_bottom_space',
374 - [
375 - 'label' => esc_html__( 'Content Spacing', 'elementor' ),
376 - 'type' => Controls_Manager::SLIDER,
377 - 'size_units' => [ 'px', 'em', 'rem', 'custom' ],
378 - 'range' => [
379 - 'px' => [
380 - 'max' => 100,
381 - ],
382 - 'em' => [
383 - 'min' => 0,
384 - 'max' => 10,
385 - ],
386 - 'rem' => [
387 - 'min' => 0,
388 - 'max' => 10,
389 - ],
390 - ],
391 - 'selectors' => [
392 - '{{WRAPPER}} .elementor-icon-box-title' => 'margin-block-end: {{SIZE}}{{UNIT}};',
393 - ],
394 - ]
395 - );
396 -
397 233 $this->end_controls_section();
398 234
399 235 $this->start_controls_section(
400 236 'section_style_icon',
@@ -400,10 +236,17 @@
400 236 'section_style_icon',
401 237 [
402 238 'label' => esc_html__( 'Icon', 'elementor' ),
403 239 'tab' => Controls_Manager::TAB_STYLE,
404 - 'condition' => [
405 - 'selected_icon[value]!' => '',
240 + 'conditions' => [
241 + 'relation' => 'or',
242 + 'terms' => [
243 + [
244 + 'name' => 'selected_icon[value]',
245 + 'operator' => '!=',
246 + 'value' => '',
247 + ],
248 + ],
406 249 ],
407 250 ]
408 251 );
409 252
@@ -463,14 +306,10 @@
463 306 'label' => esc_html__( 'Primary Color', 'elementor' ),
464 307 'type' => Controls_Manager::COLOR,
465 308 'default' => '',
466 309 'selectors' => [
467 - '{{WRAPPER}}.elementor-view-stacked:has(:hover) .elementor-icon,
468 - {{WRAPPER}}.elementor-view-stacked:has(:focus) .elementor-icon' => 'background-color: {{VALUE}};',
469 - '{{WRAPPER}}.elementor-view-framed:has(:hover) .elementor-icon,
470 - {{WRAPPER}}.elementor-view-default:has(:hover) .elementor-icon,
471 - {{WRAPPER}}.elementor-view-framed:has(:focus) .elementor-icon,
472 - {{WRAPPER}}.elementor-view-default:has(:focus) .elementor-icon' => 'fill: {{VALUE}}; color: {{VALUE}}; border-color: {{VALUE}};',
310 + '{{WRAPPER}}.elementor-view-stacked .elementor-icon:hover' => 'background-color: {{VALUE}};',
311 + '{{WRAPPER}}.elementor-view-framed .elementor-icon:hover, {{WRAPPER}}.elementor-view-default .elementor-icon:hover' => 'fill: {{VALUE}}; color: {{VALUE}}; border-color: {{VALUE}};',
473 312 ],
474 313 ]
475 314 );
476 315
@@ -483,32 +322,15 @@
483 322 'condition' => [
484 323 'view!' => 'default',
485 324 ],
486 325 'selectors' => [
487 - '{{WRAPPER}}.elementor-view-framed:has(:hover) .elementor-icon,
488 - {{WRAPPER}}.elementor-view-framed:has(:focus) .elementor-icon' => 'background-color: {{VALUE}};',
489 - '{{WRAPPER}}.elementor-view-stacked:has(:hover) .elementor-icon,
490 - {{WRAPPER}}.elementor-view-stacked:has(:focus) .elementor-icon' => 'fill: {{VALUE}}; color: {{VALUE}};',
326 + '{{WRAPPER}}.elementor-view-framed .elementor-icon:hover' => 'background-color: {{VALUE}};',
327 + '{{WRAPPER}}.elementor-view-stacked .elementor-icon:hover' => 'fill: {{VALUE}}; color: {{VALUE}};',
491 328 ],
492 329 ]
493 330 );
494 331
495 332 $this->add_control(
496 - 'hover_icon_colors_transition_duration',
497 - [
498 - 'label' => esc_html__( 'Transition Duration', 'elementor' ),
499 - 'type' => Controls_Manager::SLIDER,
500 - 'size_units' => [ 's', 'ms', 'custom' ],
501 - 'default' => [
502 - 'unit' => 's',
503 - ],
504 - 'selectors' => [
505 - '{{WRAPPER}} .elementor-icon' => 'transition-duration: {{SIZE}}{{UNIT}};',
506 - ],
507 - ]
508 - );
509 -
510 - $this->add_control(
511 333 'hover_animation',
512 334 [
513 335 'label' => esc_html__( 'Hover Animation', 'elementor' ),
514 336 'type' => Controls_Manager::HOVER_ANIMATION,
@@ -519,8 +341,29 @@
519 341
520 342 $this->end_controls_tabs();
521 343
522 344 $this->add_responsive_control(
345 + 'icon_space',
346 + [
347 + 'label' => esc_html__( 'Spacing', 'elementor' ),
348 + 'type' => Controls_Manager::SLIDER,
349 + 'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ],
350 + 'default' => [
351 + 'size' => 15,
352 + ],
353 + 'range' => [
354 + 'px' => [
355 + 'min' => 0,
356 + 'max' => 100,
357 + ],
358 + ],
359 + 'selectors' => [
360 + '{{WRAPPER}}' => '--icon-box-icon-margin: {{SIZE}}{{UNIT}}',
361 + ],
362 + ]
363 + );
364 +
365 + $this->add_responsive_control(
523 366 'icon_size',
524 367 [
525 368 'label' => esc_html__( 'Size', 'elementor' ),
526 369 'type' => Controls_Manager::SLIDER,
@@ -541,24 +384,16 @@
541 384 'icon_padding',
542 385 [
543 386 'label' => esc_html__( 'Padding', 'elementor' ),
544 387 'type' => Controls_Manager::SLIDER,
545 - 'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ],
546 388 'selectors' => [
547 389 '{{WRAPPER}} .elementor-icon' => 'padding: {{SIZE}}{{UNIT}};',
548 390 ],
549 391 'range' => [
550 - 'px' => [
551 - 'max' => 50,
552 - ],
553 392 'em' => [
554 393 'min' => 0,
555 394 'max' => 5,
556 395 ],
557 - 'rem' => [
558 - 'min' => 0,
559 - 'max' => 5,
560 - ],
561 396 ],
562 397 'condition' => [
563 398 'view!' => 'default',
564 399 ],
@@ -627,9 +462,8 @@
627 462 ],
628 463 'condition' => [
629 464 'view!' => 'default',
630 465 ],
631 - 'separator' => 'before',
632 466 ]
633 467 );
634 468
635 469 $this->end_controls_section();
@@ -641,9 +475,53 @@
641 475 'tab' => Controls_Manager::TAB_STYLE,
642 476 ]
643 477 );
644 478
479 + $this->add_responsive_control(
480 + 'text_align',
481 + [
482 + 'label' => esc_html__( 'Alignment', 'elementor' ),
483 + 'type' => Controls_Manager::CHOOSE,
484 + 'options' => [
485 + 'left' => [
486 + 'title' => esc_html__( 'Left', 'elementor' ),
487 + 'icon' => 'eicon-text-align-left',
488 + ],
489 + 'center' => [
490 + 'title' => esc_html__( 'Center', 'elementor' ),
491 + 'icon' => 'eicon-text-align-center',
492 + ],
493 + 'right' => [
494 + 'title' => esc_html__( 'Right', 'elementor' ),
495 + 'icon' => 'eicon-text-align-right',
496 + ],
497 + 'justify' => [
498 + 'title' => esc_html__( 'Justified', 'elementor' ),
499 + 'icon' => 'eicon-text-align-justify',
500 + ],
501 + ],
502 + 'selectors' => [
503 + '{{WRAPPER}} .elementor-icon-box-wrapper' => 'text-align: {{VALUE}};',
504 + ],
505 + ]
506 + );
507 +
645 508 $this->add_control(
509 + 'content_vertical_alignment',
510 + [
511 + 'label' => esc_html__( 'Vertical Alignment', 'elementor' ),
512 + 'type' => Controls_Manager::SELECT,
513 + 'options' => [
514 + 'top' => esc_html__( 'Top', 'elementor' ),
515 + 'middle' => esc_html__( 'Middle', 'elementor' ),
516 + 'bottom' => esc_html__( 'Bottom', 'elementor' ),
517 + ],
518 + 'default' => 'top',
519 + 'prefix_class' => 'elementor-vertical-align-',
520 + ]
521 + );
522 +
523 + $this->add_control(
646 524 'heading_title',
647 525 [
648 526 'label' => esc_html__( 'Title', 'elementor' ),
649 527 'type' => Controls_Manager::HEADING,
@@ -650,8 +528,40 @@
650 528 'separator' => 'before',
651 529 ]
652 530 );
653 531
532 + $this->add_responsive_control(
533 + 'title_bottom_space',
534 + [
535 + 'label' => esc_html__( 'Spacing', 'elementor' ),
536 + 'type' => Controls_Manager::SLIDER,
537 + 'range' => [
538 + 'px' => [
539 + 'min' => 0,
540 + 'max' => 100,
541 + ],
542 + ],
543 + 'selectors' => [
544 + '{{WRAPPER}} .elementor-icon-box-title' => 'margin-bottom: {{SIZE}}{{UNIT}};',
545 + ],
546 + ]
547 + );
548 +
549 + $this->add_control(
550 + 'title_color',
551 + [
552 + 'label' => esc_html__( 'Color', 'elementor' ),
553 + 'type' => Controls_Manager::COLOR,
554 + 'default' => '',
555 + 'selectors' => [
556 + '{{WRAPPER}} .elementor-icon-box-title' => 'color: {{VALUE}};',
557 + ],
558 + 'global' => [
559 + 'default' => Global_Colors::COLOR_PRIMARY,
560 + ],
561 + ]
562 + );
563 +
654 564 $this->add_group_control(
655 565 Group_Control_Typography::get_type(),
656 566 [
657 567 'name' => 'title_typography',
@@ -677,85 +587,32 @@
677 587 'selector' => '{{WRAPPER}} .elementor-icon-box-title',
678 588 ]
679 589 );
680 590
681 - $this->start_controls_tabs( 'icon_box_title_colors' );
682 -
683 - $this->start_controls_tab(
684 - 'icon_box_title_colors_normal',
685 - [
686 - 'label' => esc_html__( 'Normal', 'elementor' ),
687 - ]
688 - );
689 -
690 591 $this->add_control(
691 - 'title_color',
592 + 'heading_description',
692 593 [
693 - 'label' => esc_html__( 'Color', 'elementor' ),
694 - 'type' => Controls_Manager::COLOR,
695 - 'default' => '',
696 - 'selectors' => [
697 - '{{WRAPPER}} .elementor-icon-box-title' => 'color: {{VALUE}};',
698 - ],
699 - 'global' => [
700 - 'default' => Global_Colors::COLOR_PRIMARY,
701 - ],
594 + 'label' => esc_html__( 'Description', 'elementor' ),
595 + 'type' => Controls_Manager::HEADING,
596 + 'separator' => 'before',
702 597 ]
703 598 );
704 599
705 - $this->end_controls_tab();
706 -
707 - $this->start_controls_tab(
708 - 'icon_box_title_colors_hover',
709 - [
710 - 'label' => esc_html__( 'Hover', 'elementor' ),
711 - ]
712 - );
713 -
714 600 $this->add_control(
715 - 'hover_title_color',
601 + 'description_color',
716 602 [
717 603 'label' => esc_html__( 'Color', 'elementor' ),
718 604 'type' => Controls_Manager::COLOR,
719 605 'default' => '',
720 606 'selectors' => [
721 - '{{WRAPPER}}:has(:hover) .elementor-icon-box-title,
722 - {{WRAPPER}}:has(:focus) .elementor-icon-box-title' => 'color: {{VALUE}};',
607 + '{{WRAPPER}} .elementor-icon-box-description' => 'color: {{VALUE}};',
723 608 ],
724 609 'global' => [
725 - 'default' => Global_Colors::COLOR_PRIMARY,
610 + 'default' => Global_Colors::COLOR_TEXT,
726 611 ],
727 612 ]
728 613 );
729 614
730 - $this->add_control(
731 - 'hover_title_color_transition_duration',
732 - [
733 - 'label' => esc_html__( 'Transition Duration', 'elementor' ),
734 - 'type' => Controls_Manager::SLIDER,
735 - 'size_units' => [ 's', 'ms', 'custom' ],
736 - 'default' => [
737 - 'unit' => 's',
738 - ],
739 - 'selectors' => [
740 - '{{WRAPPER}} .elementor-icon-box-title' => 'transition-duration: {{SIZE}}{{UNIT}};',
741 - ],
742 - ]
743 - );
744 -
745 - $this->end_controls_tab();
746 -
747 - $this->end_controls_tabs();
748 -
749 - $this->add_control(
750 - 'heading_description',
751 - [
752 - 'label' => esc_html__( 'Description', 'elementor' ),
753 - 'type' => Controls_Manager::HEADING,
754 - 'separator' => 'before',
755 - ]
756 - );
757 -
758 615 $this->add_group_control(
759 616 Group_Control_Typography::get_type(),
760 617 [
761 618 'name' => 'description_typography',
@@ -773,23 +630,8 @@
773 630 'selector' => '{{WRAPPER}} .elementor-icon-box-description',
774 631 ]
775 632 );
776 633
777 - $this->add_control(
778 - 'description_color',
779 - [
780 - 'label' => esc_html__( 'Color', 'elementor' ),
781 - 'type' => Controls_Manager::COLOR,
782 - 'default' => '',
783 - 'selectors' => [
784 - '{{WRAPPER}} .elementor-icon-box-description' => 'color: {{VALUE}};',
785 - ],
786 - 'global' => [
787 - 'default' => Global_Colors::COLOR_TEXT,
788 - ],
789 - ]
790 - );
791 -
792 634 $this->end_controls_section();
793 635 }
794 636
795 637 /**
@@ -801,38 +643,27 @@
801 643 * @access protected
802 644 */
803 645 protected function render() {
804 646 $settings = $this->get_settings_for_display();
805 - $has_link = ! empty( $settings['link']['url'] );
806 - $html_tag = $has_link ? 'a' : 'span';
807 647
808 - $this->add_render_attribute( 'icon', 'class', 'elementor-icon' );
648 + $this->add_render_attribute( 'icon', 'class', [ 'elementor-icon', 'elementor-animation-' . $settings['hover_animation'] ] );
809 649
810 - if ( ! empty( $settings['hover_animation'] ) ) {
811 - $this->add_render_attribute( 'icon', 'class', 'elementor-animation-' . $settings['hover_animation'] );
650 + $icon_tag = 'span';
651 +
652 + if ( ! isset( $settings['icon'] ) && ! Icons_Manager::is_migration_allowed() ) {
653 + // add old default
654 + $settings['icon'] = 'fa fa-star';
812 655 }
813 656
814 - $has_icon = ! empty( $settings['selected_icon']['value'] );
815 - $has_content = ! Utils::is_empty( $settings['title_text'] ) || ! Utils::is_empty( $settings['description_text'] );
657 + $has_icon = ! empty( $settings['icon'] );
816 658
817 - if ( ! $has_icon && ! $has_content ) {
818 - return;
819 - }
659 + if ( ! empty( $settings['link']['url'] ) ) {
660 + $icon_tag = 'a';
820 661
821 - if ( $has_link ) {
822 662 $this->add_link_attributes( 'link', $settings['link'] );
823 - $this->add_render_attribute( 'icon', 'tabindex', '-1' );
824 - if ( ! empty( $settings['title_text'] ) ) {
825 - $this->add_render_attribute( 'icon', 'aria-label', $settings['title_text'] );
826 - }
827 663 }
828 664
829 - if ( ! isset( $settings['icon'] ) && ! Icons_Manager::is_migration_allowed() ) {
830 - // add old default
831 - $settings['icon'] = 'fa fa-star';
832 - }
833 -
834 - if ( ! empty( $settings['icon'] ) ) {
665 + if ( $has_icon ) {
835 666 $this->add_render_attribute( 'i', 'class', $settings['icon'] );
836 667 $this->add_render_attribute( 'i', 'aria-hidden', 'true' );
837 668 }
838 669
@@ -839,17 +670,19 @@
839 670 $this->add_render_attribute( 'description_text', 'class', 'elementor-icon-box-description' );
840 671
841 672 $this->add_inline_editing_attributes( 'title_text', 'none' );
842 673 $this->add_inline_editing_attributes( 'description_text' );
843 -
674 + if ( ! $has_icon && ! empty( $settings['selected_icon']['value'] ) ) {
675 + $has_icon = true;
676 + }
844 677 $migrated = isset( $settings['__fa4_migrated']['selected_icon'] );
845 678 $is_new = ! isset( $settings['icon'] ) && Icons_Manager::is_migration_allowed();
679 +
846 680 ?>
847 681 <div class="elementor-icon-box-wrapper">
848 -
849 682 <?php if ( $has_icon ) : ?>
850 683 <div class="elementor-icon-box-icon">
851 - <<?php Utils::print_validated_html_tag( $html_tag ); ?> <?php $this->print_render_attribute_string( 'link' ); ?> <?php $this->print_render_attribute_string( 'icon' ); ?>>
684 + <<?php Utils::print_validated_html_tag( $icon_tag ); ?> <?php $this->print_render_attribute_string( 'icon' ); ?> <?php $this->print_render_attribute_string( 'link' ); ?>>
852 685 <?php
853 686 if ( $is_new || $migrated ) {
854 687 Icons_Manager::render_icon( $settings['selected_icon'], [ 'aria-hidden' => 'true' ] );
855 688 } elseif ( ! empty( $settings['icon'] ) ) {
@@ -855,32 +688,23 @@
855 688 } elseif ( ! empty( $settings['icon'] ) ) {
856 689 ?><i <?php $this->print_render_attribute_string( 'i' ); ?>></i><?php
857 690 }
858 691 ?>
859 - </<?php Utils::print_validated_html_tag( $html_tag ); ?>>
692 + </<?php Utils::print_validated_html_tag( $icon_tag ); ?>>
860 693 </div>
861 694 <?php endif; ?>
862 -
863 - <?php if ( $has_content ) : ?>
864 695 <div class="elementor-icon-box-content">
865 -
866 - <?php if ( ! Utils::is_empty( $settings['title_text'] ) ) : ?>
867 - <<?php Utils::print_validated_html_tag( $settings['title_size'] ); ?> class="elementor-icon-box-title">
868 - <<?php Utils::print_validated_html_tag( $html_tag ); ?> <?php $this->print_render_attribute_string( 'link' ); ?> <?php $this->print_render_attribute_string( 'title_text' ); ?>>
869 - <?php echo wp_kses_post( $settings['title_text'] ); ?>
870 - </<?php Utils::print_validated_html_tag( $html_tag ); ?>>
871 - </<?php Utils::print_validated_html_tag( $settings['title_size'] ); ?>>
872 - <?php endif; ?>
873 -
696 + <<?php Utils::print_validated_html_tag( $settings['title_size'] ); ?> class="elementor-icon-box-title">
697 + <<?php Utils::print_validated_html_tag( $icon_tag ); ?> <?php $this->print_render_attribute_string( 'link' ); ?> <?php $this->print_render_attribute_string( 'title_text' ); ?>>
698 + <?php $this->print_unescaped_setting( 'title_text' ); ?>
699 + </<?php Utils::print_validated_html_tag( $icon_tag ); ?>>
700 + </<?php Utils::print_validated_html_tag( $settings['title_size'] ); ?>>
874 701 <?php if ( ! Utils::is_empty( $settings['description_text'] ) ) : ?>
875 702 <p <?php $this->print_render_attribute_string( 'description_text' ); ?>>
876 - <?php echo wp_kses_post( $settings['description_text'] ); ?>
703 + <?php $this->print_unescaped_setting( 'description_text' ); ?>
877 704 </p>
878 705 <?php endif; ?>
879 -
880 706 </div>
881 - <?php endif; ?>
882 -
883 707 </div>
884 708 <?php
885 709 }
886 710
@@ -894,36 +718,13 @@
894 718 */
895 719 protected function content_template() {
896 720 ?>
897 721 <#
898 - // For older version `settings.icon` is needed.
899 - var hasIcon = settings.icon || settings.selected_icon.value;
900 - var hasContent = settings.title_text || settings.description_text;
901 -
902 - if ( ! hasIcon && ! hasContent ) {
903 - return;
904 - }
905 -
906 - var hasLink = settings.link?.url,
907 - htmlTag = hasLink ? 'a' : 'span',
722 + var link = settings.link.url ? 'href="' + settings.link.url + '"' : '',
723 + iconTag = link ? 'a' : 'span',
908 724 iconHTML = elementor.helpers.renderIcon( view, settings.selected_icon, { 'aria-hidden': true }, 'i' , 'object' ),
909 - migrated = elementor.helpers.isIconMigrated( settings, 'selected_icon' ),
910 - titleSizeTag = elementor.helpers.validateHTMLTag( settings.title_size );
725 + migrated = elementor.helpers.isIconMigrated( settings, 'selected_icon' );
911 726
912 - view.addRenderAttribute( 'icon', 'class', 'elementor-icon' );
913 -
914 - if ( '' !== settings.hover_animation ) {
915 - view.addRenderAttribute( 'icon', 'class', 'elementor-animation-' + settings.hover_animation );
916 - }
917 -
918 - if ( hasLink ) {
919 - view.addRenderAttribute( 'link', 'href', elementor.helpers.sanitizeUrl( settings.link?.url ) );
920 - view.addRenderAttribute( 'icon', 'tabindex', '-1' );
921 - if ( '' !== settings.title_text ) {
922 - view.addRenderAttribute( 'icon', 'aria-label', settings.title_text );
923 - }
924 - }
925 -
926 727 view.addRenderAttribute( 'description_text', 'class', 'elementor-icon-box-description' );
927 728
928 729 view.addInlineEditingAttributes( 'title_text', 'none' );
929 730 view.addInlineEditingAttributes( 'description_text' );
@@ -928,39 +729,29 @@
928 729 view.addInlineEditingAttributes( 'title_text', 'none' );
929 730 view.addInlineEditingAttributes( 'description_text' );
930 731 #>
931 732 <div class="elementor-icon-box-wrapper">
932 -
933 - <# if ( hasIcon ) { #>
733 + <?php // settings.icon is needed for older version ?>
734 + <# if ( settings.icon || settings.selected_icon.value ) { #>
934 735 <div class="elementor-icon-box-icon">
935 - <{{{ htmlTag }}} {{{ view.getRenderAttributeString( 'link' ) }}} {{{ view.getRenderAttributeString( 'icon' ) }}}>
736 + <{{{ iconTag + ' ' + link }}} class="elementor-icon elementor-animation-{{ settings.hover_animation }}">
936 737 <# if ( iconHTML && iconHTML.rendered && ( ! settings.icon || migrated ) ) { #>
937 - {{{ elementor.helpers.sanitize( iconHTML.value ) }}}
938 - <# } else { #>
939 - <i class="{{ _.escape( settings.icon ) }}" aria-hidden="true"></i>
940 - <# } #>
941 - </{{{ htmlTag }}}>
738 + {{{ iconHTML.value }}}
739 + <# } else { #>
740 + <i class="{{ settings.icon }}" aria-hidden="true"></i>
741 + <# } #>
742 + </{{{ iconTag }}}>
942 743 </div>
943 744 <# } #>
944 -
945 - <# if ( hasContent ) { #>
946 745 <div class="elementor-icon-box-content">
947 -
948 - <# if ( settings.title_text ) { #>
746 + <# var titleSizeTag = elementor.helpers.validateHTMLTag( settings.title_size ); #>
949 747 <{{{ titleSizeTag }}} class="elementor-icon-box-title">
950 - <{{{ htmlTag }}} {{{ view.getRenderAttributeString( 'link' ) }}} {{{ view.getRenderAttributeString( 'title_text' ) }}}>
951 - {{{ elementor.helpers.sanitize( settings.title_text ) }}}
952 - </{{{ htmlTag }}}>
748 + <{{{ iconTag + ' ' + link }}} {{{ view.getRenderAttributeString( 'title_text' ) }}}>{{{ settings.title_text }}}</{{{ iconTag }}}>
953 749 </{{{ titleSizeTag }}}>
954 - <# } #>
955 -
956 750 <# if ( settings.description_text ) { #>
957 - <p {{{ view.getRenderAttributeString( 'description_text' ) }}}>{{{ elementor.helpers.sanitize( settings.description_text ) }}}</p>
751 + <p {{{ view.getRenderAttributeString( 'description_text' ) }}}>{{{ settings.description_text }}}</p>
958 752 <# } #>
959 -
960 753 </div>
961 - <# } #>
962 -
963 754 </div>
964 755 <?php
965 756 }
966 757
@@ -965,27 +756,6 @@
965 756 }
966 757
967 758 public function on_import( $element ) {
968 759 return Icons_Manager::on_import_migration( $element, 'icon', 'selected_icon', true );
969 - }
970 -
971 - public function render_markdown(): string {
972 - $settings = $this->get_settings_for_display();
973 - $title = Utils::html_to_plain_text( $settings['title_text'] ?? '' );
974 - $description = Utils::html_to_plain_text( $settings['description_text'] ?? '' );
975 - if ( empty( $title ) && empty( $description ) ) {
976 - return '';
977 - }
978 - $parts = [];
979 - if ( ! empty( $title ) ) {
980 - if ( ! empty( $settings['link']['url'] ) ) {
981 - $parts[] = '### [' . $title . '](' . esc_url( $settings['link']['url'] ) . ')';
982 - } else {
983 - $parts[] = '### ' . $title;
984 - }
985 - }
986 - if ( ! empty( $description ) ) {
987 - $parts[] = $description;
988 - }
989 - return implode( "\n\n", $parts );
990 760 }
991 761 }