PluginProbe
Elementor Website Builder – more than just a page builder / 3.14.0-beta4
Elementor Website Builder – more than just a page builder v3.14.0-beta4
4.3.4 4.3.3 4.3.2 4.3.1 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 All 457 releases
← All changes | includes/widgets/icon-box.php +194 -414 4.3.1 → 3.14.0-beta4 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,63 @@
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::CHOOSE,
513 + 'options' => [
514 + 'top' => [
515 + 'title' => esc_html__( 'Top', 'elementor' ),
516 + 'icon' => 'eicon-v-align-top',
517 + ],
518 + 'middle' => [
519 + 'title' => esc_html__( 'Middle', 'elementor' ),
520 + 'icon' => 'eicon-v-align-middle',
521 + ],
522 + 'bottom' => [
523 + 'title' => esc_html__( 'Bottom', 'elementor' ),
524 + 'icon' => 'eicon-v-align-bottom',
525 + ],
526 + ],
527 + 'default' => 'top',
528 + 'toggle' => false,
529 + 'prefix_class' => 'elementor-vertical-align-',
530 + ]
531 + );
532 +
533 + $this->add_control(
646 534 'heading_title',
647 535 [
648 536 'label' => esc_html__( 'Title', 'elementor' ),
649 537 'type' => Controls_Manager::HEADING,
@@ -650,8 +538,40 @@
650 538 'separator' => 'before',
651 539 ]
652 540 );
653 541
542 + $this->add_responsive_control(
543 + 'title_bottom_space',
544 + [
545 + 'label' => esc_html__( 'Spacing', 'elementor' ),
546 + 'type' => Controls_Manager::SLIDER,
547 + 'range' => [
548 + 'px' => [
549 + 'min' => 0,
550 + 'max' => 100,
551 + ],
552 + ],
553 + 'selectors' => [
554 + '{{WRAPPER}} .elementor-icon-box-title' => 'margin-bottom: {{SIZE}}{{UNIT}};',
555 + ],
556 + ]
557 + );
558 +
559 + $this->add_control(
560 + 'title_color',
561 + [
562 + 'label' => esc_html__( 'Color', 'elementor' ),
563 + 'type' => Controls_Manager::COLOR,
564 + 'default' => '',
565 + 'selectors' => [
566 + '{{WRAPPER}} .elementor-icon-box-title' => 'color: {{VALUE}};',
567 + ],
568 + 'global' => [
569 + 'default' => Global_Colors::COLOR_PRIMARY,
570 + ],
571 + ]
572 + );
573 +
654 574 $this->add_group_control(
655 575 Group_Control_Typography::get_type(),
656 576 [
657 577 'name' => 'title_typography',
@@ -677,85 +597,32 @@
677 597 'selector' => '{{WRAPPER}} .elementor-icon-box-title',
678 598 ]
679 599 );
680 600
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 601 $this->add_control(
691 - 'title_color',
602 + 'heading_description',
692 603 [
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 - ],
604 + 'label' => esc_html__( 'Description', 'elementor' ),
605 + 'type' => Controls_Manager::HEADING,
606 + 'separator' => 'before',
702 607 ]
703 608 );
704 609
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 610 $this->add_control(
715 - 'hover_title_color',
611 + 'description_color',
716 612 [
717 613 'label' => esc_html__( 'Color', 'elementor' ),
718 614 'type' => Controls_Manager::COLOR,
719 615 'default' => '',
720 616 'selectors' => [
721 - '{{WRAPPER}}:has(:hover) .elementor-icon-box-title,
722 - {{WRAPPER}}:has(:focus) .elementor-icon-box-title' => 'color: {{VALUE}};',
617 + '{{WRAPPER}} .elementor-icon-box-description' => 'color: {{VALUE}};',
723 618 ],
724 619 'global' => [
725 - 'default' => Global_Colors::COLOR_PRIMARY,
620 + 'default' => Global_Colors::COLOR_TEXT,
726 621 ],
727 622 ]
728 623 );
729 624
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 625 $this->add_group_control(
759 626 Group_Control_Typography::get_type(),
760 627 [
761 628 'name' => 'description_typography',
@@ -773,23 +640,8 @@
773 640 'selector' => '{{WRAPPER}} .elementor-icon-box-description',
774 641 ]
775 642 );
776 643
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 644 $this->end_controls_section();
793 645 }
794 646
795 647 /**
@@ -801,38 +653,27 @@
801 653 * @access protected
802 654 */
803 655 protected function render() {
804 656 $settings = $this->get_settings_for_display();
805 - $has_link = ! empty( $settings['link']['url'] );
806 - $html_tag = $has_link ? 'a' : 'span';
807 657
808 - $this->add_render_attribute( 'icon', 'class', 'elementor-icon' );
658 + $this->add_render_attribute( 'icon', 'class', [ 'elementor-icon', 'elementor-animation-' . $settings['hover_animation'] ] );
809 659
810 - if ( ! empty( $settings['hover_animation'] ) ) {
811 - $this->add_render_attribute( 'icon', 'class', 'elementor-animation-' . $settings['hover_animation'] );
660 + $icon_tag = 'span';
661 +
662 + if ( ! isset( $settings['icon'] ) && ! Icons_Manager::is_migration_allowed() ) {
663 + // add old default
664 + $settings['icon'] = 'fa fa-star';
812 665 }
813 666
814 - $has_icon = ! empty( $settings['selected_icon']['value'] );
815 - $has_content = ! Utils::is_empty( $settings['title_text'] ) || ! Utils::is_empty( $settings['description_text'] );
667 + $has_icon = ! empty( $settings['icon'] );
816 668
817 - if ( ! $has_icon && ! $has_content ) {
818 - return;
819 - }
669 + if ( ! empty( $settings['link']['url'] ) ) {
670 + $icon_tag = 'a';
820 671
821 - if ( $has_link ) {
822 672 $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 673 }
828 674
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'] ) ) {
675 + if ( $has_icon ) {
835 676 $this->add_render_attribute( 'i', 'class', $settings['icon'] );
836 677 $this->add_render_attribute( 'i', 'aria-hidden', 'true' );
837 678 }
838 679
@@ -839,17 +680,19 @@
839 680 $this->add_render_attribute( 'description_text', 'class', 'elementor-icon-box-description' );
840 681
841 682 $this->add_inline_editing_attributes( 'title_text', 'none' );
842 683 $this->add_inline_editing_attributes( 'description_text' );
843 -
684 + if ( ! $has_icon && ! empty( $settings['selected_icon']['value'] ) ) {
685 + $has_icon = true;
686 + }
844 687 $migrated = isset( $settings['__fa4_migrated']['selected_icon'] );
845 688 $is_new = ! isset( $settings['icon'] ) && Icons_Manager::is_migration_allowed();
689 +
846 690 ?>
847 691 <div class="elementor-icon-box-wrapper">
848 -
849 692 <?php if ( $has_icon ) : ?>
850 693 <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' ); ?>>
694 + <<?php Utils::print_validated_html_tag( $icon_tag ); ?> <?php $this->print_render_attribute_string( 'icon' ); ?> <?php $this->print_render_attribute_string( 'link' ); ?>>
852 695 <?php
853 696 if ( $is_new || $migrated ) {
854 697 Icons_Manager::render_icon( $settings['selected_icon'], [ 'aria-hidden' => 'true' ] );
855 698 } elseif ( ! empty( $settings['icon'] ) ) {
@@ -855,32 +698,23 @@
855 698 } elseif ( ! empty( $settings['icon'] ) ) {
856 699 ?><i <?php $this->print_render_attribute_string( 'i' ); ?>></i><?php
857 700 }
858 701 ?>
859 - </<?php Utils::print_validated_html_tag( $html_tag ); ?>>
702 + </<?php Utils::print_validated_html_tag( $icon_tag ); ?>>
860 703 </div>
861 704 <?php endif; ?>
862 -
863 - <?php if ( $has_content ) : ?>
864 705 <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 -
706 + <<?php Utils::print_validated_html_tag( $settings['title_size'] ); ?> class="elementor-icon-box-title">
707 + <<?php Utils::print_validated_html_tag( $icon_tag ); ?> <?php $this->print_render_attribute_string( 'link' ); ?> <?php $this->print_render_attribute_string( 'title_text' ); ?>>
708 + <?php $this->print_unescaped_setting( 'title_text' ); ?>
709 + </<?php Utils::print_validated_html_tag( $icon_tag ); ?>>
710 + </<?php Utils::print_validated_html_tag( $settings['title_size'] ); ?>>
874 711 <?php if ( ! Utils::is_empty( $settings['description_text'] ) ) : ?>
875 712 <p <?php $this->print_render_attribute_string( 'description_text' ); ?>>
876 - <?php echo wp_kses_post( $settings['description_text'] ); ?>
713 + <?php $this->print_unescaped_setting( 'description_text' ); ?>
877 714 </p>
878 715 <?php endif; ?>
879 -
880 716 </div>
881 - <?php endif; ?>
882 -
883 717 </div>
884 718 <?php
885 719 }
886 720
@@ -894,36 +728,13 @@
894 728 */
895 729 protected function content_template() {
896 730 ?>
897 731 <#
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',
732 + var link = settings.link.url ? 'href="' + settings.link.url + '"' : '',
733 + iconTag = link ? 'a' : 'span',
908 734 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 );
735 + migrated = elementor.helpers.isIconMigrated( settings, 'selected_icon' );
911 736
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 737 view.addRenderAttribute( 'description_text', 'class', 'elementor-icon-box-description' );
927 738
928 739 view.addInlineEditingAttributes( 'title_text', 'none' );
929 740 view.addInlineEditingAttributes( 'description_text' );
@@ -928,39 +739,29 @@
928 739 view.addInlineEditingAttributes( 'title_text', 'none' );
929 740 view.addInlineEditingAttributes( 'description_text' );
930 741 #>
931 742 <div class="elementor-icon-box-wrapper">
932 -
933 - <# if ( hasIcon ) { #>
743 + <?php // settings.icon is needed for older version ?>
744 + <# if ( settings.icon || settings.selected_icon.value ) { #>
934 745 <div class="elementor-icon-box-icon">
935 - <{{{ htmlTag }}} {{{ view.getRenderAttributeString( 'link' ) }}} {{{ view.getRenderAttributeString( 'icon' ) }}}>
746 + <{{{ iconTag + ' ' + link }}} class="elementor-icon elementor-animation-{{ settings.hover_animation }}">
936 747 <# 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 }}}>
748 + {{{ iconHTML.value }}}
749 + <# } else { #>
750 + <i class="{{ settings.icon }}" aria-hidden="true"></i>
751 + <# } #>
752 + </{{{ iconTag }}}>
942 753 </div>
943 754 <# } #>
944 -
945 - <# if ( hasContent ) { #>
946 755 <div class="elementor-icon-box-content">
947 -
948 - <# if ( settings.title_text ) { #>
756 + <# var titleSizeTag = elementor.helpers.validateHTMLTag( settings.title_size ); #>
949 757 <{{{ titleSizeTag }}} class="elementor-icon-box-title">
950 - <{{{ htmlTag }}} {{{ view.getRenderAttributeString( 'link' ) }}} {{{ view.getRenderAttributeString( 'title_text' ) }}}>
951 - {{{ elementor.helpers.sanitize( settings.title_text ) }}}
952 - </{{{ htmlTag }}}>
758 + <{{{ iconTag + ' ' + link }}} {{{ view.getRenderAttributeString( 'title_text' ) }}}>{{{ settings.title_text }}}</{{{ iconTag }}}>
953 759 </{{{ titleSizeTag }}}>
954 - <# } #>
955 -
956 760 <# if ( settings.description_text ) { #>
957 - <p {{{ view.getRenderAttributeString( 'description_text' ) }}}>{{{ elementor.helpers.sanitize( settings.description_text ) }}}</p>
761 + <p {{{ view.getRenderAttributeString( 'description_text' ) }}}>{{{ settings.description_text }}}</p>
958 762 <# } #>
959 -
960 763 </div>
961 - <# } #>
962 -
963 764 </div>
964 765 <?php
965 766 }
966 767
@@ -965,27 +766,6 @@
965 766 }
966 767
967 768 public function on_import( $element ) {
968 769 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 770 }
991 771 }