PluginProbe
Elementor Website Builder – more than just a page builder / 3.19.1
Elementor Website Builder – more than just a page builder v3.19.1
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
elementor / includes / widgets / icon-box.php

icon-box.php in Elementor Website Builder – more than just a page builder 3.19.1, at includes/widgets/icon-box.php

805 lines 20.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Elementor;
3
4 if ( ! defined( 'ABSPATH' ) ) {
5 exit; // Exit if accessed directly.
6 }
7
8 use Elementor\Core\Kits\Documents\Tabs\Global_Colors;
9 use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
10
11 /**
12 * Elementor icon box widget.
13 *
14 * Elementor widget that displays an icon, a headline and a text.
15 *
16 * @since 1.0.0
17 */
18 class Widget_Icon_Box extends Widget_Base {
19
20 /**
21 * Get widget name.
22 *
23 * Retrieve icon box widget name.
24 *
25 * @since 1.0.0
26 * @access public
27 *
28 * @return string Widget name.
29 */
30 public function get_name() {
31 return 'icon-box';
32 }
33
34 /**
35 * Get widget title.
36 *
37 * Retrieve icon box widget title.
38 *
39 * @since 1.0.0
40 * @access public
41 *
42 * @return string Widget title.
43 */
44 public function get_title() {
45 return esc_html__( 'Icon Box', 'elementor' );
46 }
47
48 /**
49 * Get widget icon.
50 *
51 * Retrieve icon box widget icon.
52 *
53 * @since 1.0.0
54 * @access public
55 *
56 * @return string Widget icon.
57 */
58 public function get_icon() {
59 return 'eicon-icon-box';
60 }
61
62 /**
63 * Get widget keywords.
64 *
65 * Retrieve the list of keywords the widget belongs to.
66 *
67 * @since 2.1.0
68 * @access public
69 *
70 * @return array Widget keywords.
71 */
72 public function get_keywords() {
73 return [ 'icon box', 'icon' ];
74 }
75
76 /**
77 * Register icon box widget controls.
78 *
79 * Adds different input fields to allow the user to change and customize the widget settings.
80 *
81 * @since 3.1.0
82 * @access protected
83 */
84 protected function register_controls() {
85 $this->start_controls_section(
86 'section_icon',
87 [
88 'label' => esc_html__( 'Icon Box', 'elementor' ),
89 ]
90 );
91
92 $this->add_control(
93 'selected_icon',
94 [
95 'label' => esc_html__( 'Icon', 'elementor' ),
96 'type' => Controls_Manager::ICONS,
97 'fa4compatibility' => 'icon',
98 'default' => [
99 'value' => 'fas fa-star',
100 'library' => 'fa-solid',
101 ],
102 ]
103 );
104
105 $this->add_control(
106 'view',
107 [
108 'label' => esc_html__( 'View', 'elementor' ),
109 'type' => Controls_Manager::SELECT,
110 'options' => [
111 'default' => esc_html__( 'Default', 'elementor' ),
112 'stacked' => esc_html__( 'Stacked', 'elementor' ),
113 'framed' => esc_html__( 'Framed', 'elementor' ),
114 ],
115 'default' => 'default',
116 'prefix_class' => 'elementor-view-',
117 'condition' => [
118 'selected_icon[value]!' => '',
119 ],
120 ]
121 );
122
123 $this->add_control(
124 'shape',
125 [
126 'label' => esc_html__( 'Shape', 'elementor' ),
127 'type' => Controls_Manager::SELECT,
128 'options' => [
129 'circle' => esc_html__( 'Circle', 'elementor' ),
130 'square' => esc_html__( 'Square', 'elementor' ),
131 ],
132 'default' => 'circle',
133 'condition' => [
134 'view!' => 'default',
135 'selected_icon[value]!' => '',
136 ],
137 'prefix_class' => 'elementor-shape-',
138 ]
139 );
140
141 $this->add_control(
142 'title_text',
143 [
144 'label' => esc_html__( 'Title', 'elementor' ),
145 'type' => Controls_Manager::TEXT,
146 'dynamic' => [
147 'active' => true,
148 ],
149 'default' => esc_html__( 'This is the heading', 'elementor' ),
150 'placeholder' => esc_html__( 'Enter your title', 'elementor' ),
151 'label_block' => true,
152 ]
153 );
154
155 $this->add_control(
156 'description_text',
157 [
158 'label' => esc_html__( 'Description', 'elementor' ),
159 'type' => Controls_Manager::TEXTAREA,
160 'dynamic' => [
161 'active' => true,
162 ],
163 'default' => esc_html__( 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.', 'elementor' ),
164 'placeholder' => esc_html__( 'Enter your description', 'elementor' ),
165 'rows' => 10,
166 ]
167 );
168
169 $this->add_control(
170 'link',
171 [
172 'label' => esc_html__( 'Link', 'elementor' ),
173 'type' => Controls_Manager::URL,
174 'dynamic' => [
175 'active' => true,
176 ],
177 'separator' => 'before',
178 ]
179 );
180
181 $this->add_control(
182 'title_size',
183 [
184 'label' => esc_html__( 'Title HTML Tag', 'elementor' ),
185 'type' => Controls_Manager::SELECT,
186 'options' => [
187 'h1' => 'H1',
188 'h2' => 'H2',
189 'h3' => 'H3',
190 'h4' => 'H4',
191 'h5' => 'H5',
192 'h6' => 'H6',
193 'div' => 'div',
194 'span' => 'span',
195 'p' => 'p',
196 ],
197 'default' => 'h3',
198 ]
199 );
200
201 $this->end_controls_section();
202
203 $this->start_controls_section(
204 'section_style_box',
205 [
206 'label' => esc_html__( 'Box', 'elementor' ),
207 'tab' => Controls_Manager::TAB_STYLE,
208 ]
209 );
210
211 $this->add_responsive_control(
212 'position',
213 [
214 'label' => esc_html__( 'Icon Position', 'elementor' ),
215 'type' => Controls_Manager::CHOOSE,
216 'default' => 'top',
217 'mobile_default' => 'top',
218 'options' => [
219 'left' => [
220 'title' => esc_html__( 'Left', 'elementor' ),
221 'icon' => 'eicon-h-align-left',
222 ],
223 'top' => [
224 'title' => esc_html__( 'Top', 'elementor' ),
225 'icon' => 'eicon-v-align-top',
226 ],
227 'right' => [
228 'title' => esc_html__( 'Right', 'elementor' ),
229 'icon' => 'eicon-h-align-right',
230 ],
231 ],
232 'prefix_class' => 'elementor%s-position-',
233 'condition' => [
234 'selected_icon[value]!' => '',
235 ],
236 ]
237 );
238
239 $this->add_responsive_control(
240 'content_vertical_alignment',
241 [
242 'label' => esc_html__( 'Vertical Alignment', 'elementor' ),
243 'type' => Controls_Manager::CHOOSE,
244 'options' => [
245 'top' => [
246 'title' => esc_html__( 'Top', 'elementor' ),
247 'icon' => 'eicon-v-align-top',
248 ],
249 'middle' => [
250 'title' => esc_html__( 'Middle', 'elementor' ),
251 'icon' => 'eicon-v-align-middle',
252 ],
253 'bottom' => [
254 'title' => esc_html__( 'Bottom', 'elementor' ),
255 'icon' => 'eicon-v-align-bottom',
256 ],
257 ],
258 'default' => 'top',
259 'toggle' => false,
260 'prefix_class' => 'elementor-vertical-align-',
261 'condition' => [
262 'position!' => 'top',
263 ],
264 ]
265 );
266
267 $this->add_responsive_control(
268 'text_align',
269 [
270 'label' => esc_html__( 'Alignment', 'elementor' ),
271 'type' => Controls_Manager::CHOOSE,
272 'options' => [
273 'left' => [
274 'title' => esc_html__( 'Left', 'elementor' ),
275 'icon' => 'eicon-text-align-left',
276 ],
277 'center' => [
278 'title' => esc_html__( 'Center', 'elementor' ),
279 'icon' => 'eicon-text-align-center',
280 ],
281 'right' => [
282 'title' => esc_html__( 'Right', 'elementor' ),
283 'icon' => 'eicon-text-align-right',
284 ],
285 'justify' => [
286 'title' => esc_html__( 'Justified', 'elementor' ),
287 'icon' => 'eicon-text-align-justify',
288 ],
289 ],
290 'selectors' => [
291 '{{WRAPPER}} .elementor-icon-box-wrapper' => 'text-align: {{VALUE}};',
292 ],
293 ]
294 );
295
296 $this->end_controls_section();
297
298 $this->start_controls_section(
299 'section_style_icon',
300 [
301 'label' => esc_html__( 'Icon', 'elementor' ),
302 'tab' => Controls_Manager::TAB_STYLE,
303 'condition' => [
304 'selected_icon[value]!' => '',
305 ],
306 ]
307 );
308
309 $this->start_controls_tabs( 'icon_colors' );
310
311 $this->start_controls_tab(
312 'icon_colors_normal',
313 [
314 'label' => esc_html__( 'Normal', 'elementor' ),
315 ]
316 );
317
318 $this->add_control(
319 'primary_color',
320 [
321 'label' => esc_html__( 'Primary Color', 'elementor' ),
322 'type' => Controls_Manager::COLOR,
323 'global' => [
324 'default' => Global_Colors::COLOR_PRIMARY,
325 ],
326 'default' => '',
327 'selectors' => [
328 '{{WRAPPER}}.elementor-view-stacked .elementor-icon' => 'background-color: {{VALUE}};',
329 '{{WRAPPER}}.elementor-view-framed .elementor-icon, {{WRAPPER}}.elementor-view-default .elementor-icon' => 'fill: {{VALUE}}; color: {{VALUE}}; border-color: {{VALUE}};',
330 ],
331 ]
332 );
333
334 $this->add_control(
335 'secondary_color',
336 [
337 'label' => esc_html__( 'Secondary Color', 'elementor' ),
338 'type' => Controls_Manager::COLOR,
339 'default' => '',
340 'condition' => [
341 'view!' => 'default',
342 ],
343 'selectors' => [
344 '{{WRAPPER}}.elementor-view-framed .elementor-icon' => 'background-color: {{VALUE}};',
345 '{{WRAPPER}}.elementor-view-stacked .elementor-icon' => 'fill: {{VALUE}}; color: {{VALUE}};',
346 ],
347 ]
348 );
349
350 $this->end_controls_tab();
351
352 $this->start_controls_tab(
353 'icon_colors_hover',
354 [
355 'label' => esc_html__( 'Hover', 'elementor' ),
356 ]
357 );
358
359 $this->add_control(
360 'hover_primary_color',
361 [
362 'label' => esc_html__( 'Primary Color', 'elementor' ),
363 'type' => Controls_Manager::COLOR,
364 'default' => '',
365 'selectors' => [
366 '{{WRAPPER}}.elementor-view-stacked .elementor-icon:hover' => 'background-color: {{VALUE}};',
367 '{{WRAPPER}}.elementor-view-framed .elementor-icon:hover, {{WRAPPER}}.elementor-view-default .elementor-icon:hover' => 'fill: {{VALUE}}; color: {{VALUE}}; border-color: {{VALUE}};',
368 ],
369 ]
370 );
371
372 $this->add_control(
373 'hover_secondary_color',
374 [
375 'label' => esc_html__( 'Secondary Color', 'elementor' ),
376 'type' => Controls_Manager::COLOR,
377 'default' => '',
378 'condition' => [
379 'view!' => 'default',
380 ],
381 'selectors' => [
382 '{{WRAPPER}}.elementor-view-framed .elementor-icon:hover' => 'background-color: {{VALUE}};',
383 '{{WRAPPER}}.elementor-view-stacked .elementor-icon:hover' => 'fill: {{VALUE}}; color: {{VALUE}};',
384 ],
385 ]
386 );
387
388 $this->add_control(
389 'hover_animation',
390 [
391 'label' => esc_html__( 'Hover Animation', 'elementor' ),
392 'type' => Controls_Manager::HOVER_ANIMATION,
393 ]
394 );
395
396 $this->end_controls_tab();
397
398 $this->end_controls_tabs();
399
400 $this->add_responsive_control(
401 'icon_space',
402 [
403 'label' => esc_html__( 'Spacing', 'elementor' ),
404 'type' => Controls_Manager::SLIDER,
405 'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ],
406 'default' => [
407 'size' => 15,
408 ],
409 'range' => [
410 'px' => [
411 'max' => 100,
412 ],
413 'em' => [
414 'max' => 10,
415 ],
416 'rem' => [
417 'max' => 10,
418 ],
419 ],
420 'selectors' => [
421 '{{WRAPPER}}' => '--icon-box-icon-margin: {{SIZE}}{{UNIT}}',
422 ],
423 'separator' => 'before',
424 ]
425 );
426
427 $this->add_responsive_control(
428 'icon_size',
429 [
430 'label' => esc_html__( 'Size', 'elementor' ),
431 'type' => Controls_Manager::SLIDER,
432 'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ],
433 'range' => [
434 'px' => [
435 'min' => 6,
436 'max' => 300,
437 ],
438 ],
439 'selectors' => [
440 '{{WRAPPER}} .elementor-icon' => 'font-size: {{SIZE}}{{UNIT}};',
441 ],
442 ]
443 );
444
445 $this->add_responsive_control(
446 'icon_padding',
447 [
448 'label' => esc_html__( 'Padding', 'elementor' ),
449 'type' => Controls_Manager::SLIDER,
450 'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ],
451 'selectors' => [
452 '{{WRAPPER}} .elementor-icon' => 'padding: {{SIZE}}{{UNIT}};',
453 ],
454 'range' => [
455 'px' => [
456 'max' => 50,
457 ],
458 'em' => [
459 'min' => 0,
460 'max' => 5,
461 ],
462 'rem' => [
463 'min' => 0,
464 'max' => 5,
465 ],
466 ],
467 'condition' => [
468 'view!' => 'default',
469 ],
470 ]
471 );
472
473 $active_breakpoints = Plugin::$instance->breakpoints->get_active_breakpoints();
474
475 $rotate_device_args = [];
476
477 $rotate_device_settings = [
478 'default' => [
479 'unit' => 'deg',
480 ],
481 ];
482
483 foreach ( $active_breakpoints as $breakpoint_name => $breakpoint ) {
484 $rotate_device_args[ $breakpoint_name ] = $rotate_device_settings;
485 }
486
487 $this->add_responsive_control(
488 'rotate',
489 [
490 'label' => esc_html__( 'Rotate', 'elementor' ),
491 'type' => Controls_Manager::SLIDER,
492 'size_units' => [ 'deg', 'grad', 'rad', 'turn', 'custom' ],
493 'default' => [
494 'unit' => 'deg',
495 ],
496 'tablet_default' => [
497 'unit' => 'deg',
498 ],
499 'mobile_default' => [
500 'unit' => 'deg',
501 ],
502 'device_args' => $rotate_device_args,
503 'selectors' => [
504 '{{WRAPPER}} .elementor-icon i' => 'transform: rotate({{SIZE}}{{UNIT}});',
505 ],
506 ]
507 );
508
509 $this->add_responsive_control(
510 'border_width',
511 [
512 'label' => esc_html__( 'Border Width', 'elementor' ),
513 'type' => Controls_Manager::DIMENSIONS,
514 'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ],
515 'selectors' => [
516 '{{WRAPPER}} .elementor-icon' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
517 ],
518 'condition' => [
519 'view' => 'framed',
520 ],
521 ]
522 );
523
524 $this->add_responsive_control(
525 'border_radius',
526 [
527 'label' => esc_html__( 'Border Radius', 'elementor' ),
528 'type' => Controls_Manager::DIMENSIONS,
529 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
530 'selectors' => [
531 '{{WRAPPER}} .elementor-icon' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
532 ],
533 'condition' => [
534 'view!' => 'default',
535 ],
536 'separator' => 'before',
537 ]
538 );
539
540 $this->end_controls_section();
541
542 $this->start_controls_section(
543 'section_style_content',
544 [
545 'label' => esc_html__( 'Content', 'elementor' ),
546 'tab' => Controls_Manager::TAB_STYLE,
547 ]
548 );
549
550 $this->add_control(
551 'heading_title',
552 [
553 'label' => esc_html__( 'Title', 'elementor' ),
554 'type' => Controls_Manager::HEADING,
555 'separator' => 'before',
556 ]
557 );
558
559 $this->add_responsive_control(
560 'title_bottom_space',
561 [
562 'label' => esc_html__( 'Spacing', 'elementor' ),
563 'type' => Controls_Manager::SLIDER,
564 'size_units' => [ 'px', 'em', 'rem', 'custom' ],
565 'range' => [
566 'px' => [
567 'max' => 100,
568 ],
569 'em' => [
570 'min' => 0,
571 'max' => 10,
572 ],
573 'rem' => [
574 'min' => 0,
575 'max' => 10,
576 ],
577 ],
578 'selectors' => [
579 '{{WRAPPER}} .elementor-icon-box-title' => 'margin-bottom: {{SIZE}}{{UNIT}};',
580 ],
581 ]
582 );
583
584 $this->add_control(
585 'title_color',
586 [
587 'label' => esc_html__( 'Color', 'elementor' ),
588 'type' => Controls_Manager::COLOR,
589 'default' => '',
590 'selectors' => [
591 '{{WRAPPER}} .elementor-icon-box-title' => 'color: {{VALUE}};',
592 ],
593 'global' => [
594 'default' => Global_Colors::COLOR_PRIMARY,
595 ],
596 ]
597 );
598
599 $this->add_group_control(
600 Group_Control_Typography::get_type(),
601 [
602 'name' => 'title_typography',
603 'selector' => '{{WRAPPER}} .elementor-icon-box-title, {{WRAPPER}} .elementor-icon-box-title a',
604 'global' => [
605 'default' => Global_Typography::TYPOGRAPHY_PRIMARY,
606 ],
607 ]
608 );
609
610 $this->add_group_control(
611 Group_Control_Text_Stroke::get_type(),
612 [
613 'name' => 'text_stroke',
614 'selector' => '{{WRAPPER}} .elementor-icon-box-title',
615 ]
616 );
617
618 $this->add_group_control(
619 Group_Control_Text_Shadow::get_type(),
620 [
621 'name' => 'title_shadow',
622 'selector' => '{{WRAPPER}} .elementor-icon-box-title',
623 ]
624 );
625
626 $this->add_control(
627 'heading_description',
628 [
629 'label' => esc_html__( 'Description', 'elementor' ),
630 'type' => Controls_Manager::HEADING,
631 'separator' => 'before',
632 ]
633 );
634
635 $this->add_control(
636 'description_color',
637 [
638 'label' => esc_html__( 'Color', 'elementor' ),
639 'type' => Controls_Manager::COLOR,
640 'default' => '',
641 'selectors' => [
642 '{{WRAPPER}} .elementor-icon-box-description' => 'color: {{VALUE}};',
643 ],
644 'global' => [
645 'default' => Global_Colors::COLOR_TEXT,
646 ],
647 ]
648 );
649
650 $this->add_group_control(
651 Group_Control_Typography::get_type(),
652 [
653 'name' => 'description_typography',
654 'selector' => '{{WRAPPER}} .elementor-icon-box-description',
655 'global' => [
656 'default' => Global_Typography::TYPOGRAPHY_TEXT,
657 ],
658 ]
659 );
660
661 $this->add_group_control(
662 Group_Control_Text_Shadow::get_type(),
663 [
664 'name' => 'description_shadow',
665 'selector' => '{{WRAPPER}} .elementor-icon-box-description',
666 ]
667 );
668
669 $this->end_controls_section();
670 }
671
672 /**
673 * Render icon box widget output on the frontend.
674 *
675 * Written in PHP and used to generate the final HTML.
676 *
677 * @since 1.0.0
678 * @access protected
679 */
680 protected function render() {
681 $settings = $this->get_settings_for_display();
682 $has_link = ! empty( $settings['link']['url'] );
683 $html_tag = $has_link ? 'a' : 'span';
684
685 $this->add_render_attribute( 'icon', 'class', [ 'elementor-icon', 'elementor-animation-' . $settings['hover_animation'] ] );
686
687 if ( ! isset( $settings['icon'] ) && ! Icons_Manager::is_migration_allowed() ) {
688 // add old default
689 $settings['icon'] = 'fa fa-star';
690 }
691
692 $has_icon = ! empty( $settings['icon'] );
693
694 if ( $has_link ) {
695 $this->add_link_attributes( 'link', $settings['link'] );
696 $this->add_render_attribute( 'icon', 'tabindex', '-1' );
697 }
698
699 if ( $has_icon ) {
700 $this->add_render_attribute( 'i', 'class', $settings['icon'] );
701 $this->add_render_attribute( 'i', 'aria-hidden', 'true' );
702 }
703
704 $this->add_render_attribute( 'description_text', 'class', 'elementor-icon-box-description' );
705
706 $this->add_inline_editing_attributes( 'title_text', 'none' );
707 $this->add_inline_editing_attributes( 'description_text' );
708 if ( ! $has_icon && ! empty( $settings['selected_icon']['value'] ) ) {
709 $has_icon = true;
710 }
711 $migrated = isset( $settings['__fa4_migrated']['selected_icon'] );
712 $is_new = ! isset( $settings['icon'] ) && Icons_Manager::is_migration_allowed();
713
714 ?>
715 <div class="elementor-icon-box-wrapper">
716 <?php if ( $has_icon ) : ?>
717 <div class="elementor-icon-box-icon">
718 <<?php Utils::print_validated_html_tag( $html_tag ); ?> <?php $this->print_render_attribute_string( 'link' ); ?> <?php $this->print_render_attribute_string( 'icon' ); ?>>
719 <?php
720 if ( $is_new || $migrated ) {
721 Icons_Manager::render_icon( $settings['selected_icon'], [ 'aria-hidden' => 'true' ] );
722 } elseif ( ! empty( $settings['icon'] ) ) {
723 ?><i <?php $this->print_render_attribute_string( 'i' ); ?>></i><?php
724 }
725 ?>
726 </<?php Utils::print_validated_html_tag( $html_tag ); ?>>
727 </div>
728 <?php endif; ?>
729 <div class="elementor-icon-box-content">
730 <<?php Utils::print_validated_html_tag( $settings['title_size'] ); ?> class="elementor-icon-box-title">
731 <<?php Utils::print_validated_html_tag( $html_tag ); ?> <?php $this->print_render_attribute_string( 'link' ); ?> <?php $this->print_render_attribute_string( 'title_text' ); ?>>
732 <?php $this->print_unescaped_setting( 'title_text' ); ?>
733 </<?php Utils::print_validated_html_tag( $html_tag ); ?>>
734 </<?php Utils::print_validated_html_tag( $settings['title_size'] ); ?>>
735 <?php if ( ! Utils::is_empty( $settings['description_text'] ) ) : ?>
736 <p <?php $this->print_render_attribute_string( 'description_text' ); ?>>
737 <?php $this->print_unescaped_setting( 'description_text' ); ?>
738 </p>
739 <?php endif; ?>
740 </div>
741 </div>
742 <?php
743 }
744
745 /**
746 * Render icon box widget output in the editor.
747 *
748 * Written as a Backbone JavaScript template and used to generate the live preview.
749 *
750 * @since 2.9.0
751 * @access protected
752 */
753 protected function content_template() {
754 ?>
755 <#
756 var hasLink = settings.link.url,
757 htmlTag = hasLink ? 'a' : 'span',
758 iconHTML = elementor.helpers.renderIcon( view, settings.selected_icon, { 'aria-hidden': true }, 'i' , 'object' ),
759 migrated = elementor.helpers.isIconMigrated( settings, 'selected_icon' );
760
761 view.addRenderAttribute( 'icon', 'class', 'elementor-icon elementor-animation-' + settings.hover_animation );
762
763 if ( hasLink ) {
764 view.addRenderAttribute( 'link', 'href', settings.link.url );
765 view.addRenderAttribute( 'icon', 'tabindex', '-1' );
766 }
767
768 view.addRenderAttribute( 'description_text', 'class', 'elementor-icon-box-description' );
769
770 view.addInlineEditingAttributes( 'title_text', 'none' );
771 view.addInlineEditingAttributes( 'description_text' );
772 #>
773 <div class="elementor-icon-box-wrapper">
774 <?php // settings.icon is needed for older version ?>
775 <# if ( settings.icon || settings.selected_icon.value ) { #>
776 <div class="elementor-icon-box-icon">
777 <{{{ htmlTag }}} {{{ view.getRenderAttributeString( 'link' ) }}} {{{ view.getRenderAttributeString( 'icon' ) }}}>
778 <# if ( iconHTML && iconHTML.rendered && ( ! settings.icon || migrated ) ) { #>
779 {{{ iconHTML.value }}}
780 <# } else { #>
781 <i class="{{ settings.icon }}" aria-hidden="true"></i>
782 <# } #>
783 </{{{ htmlTag }}}>
784 </div>
785 <# } #>
786 <div class="elementor-icon-box-content">
787 <# var titleSizeTag = elementor.helpers.validateHTMLTag( settings.title_size ); #>
788 <{{{ titleSizeTag }}} class="elementor-icon-box-title">
789 <{{{ htmlTag }}} {{{ view.getRenderAttributeString( 'link' ) }}} {{{ view.getRenderAttributeString( 'title_text' ) }}}>
790 {{{ settings.title_text }}}
791 </{{{ htmlTag }}}>
792 </{{{ titleSizeTag }}}>
793 <# if ( settings.description_text ) { #>
794 <p {{{ view.getRenderAttributeString( 'description_text' ) }}}>{{{ settings.description_text }}}</p>
795 <# } #>
796 </div>
797 </div>
798 <?php
799 }
800
801 public function on_import( $element ) {
802 return Icons_Manager::on_import_migration( $element, 'icon', 'selected_icon', true );
803 }
804 }
805