PluginProbe
Enter Addons – Ultimate Template Builder for Elementor / trunk
Enter Addons – Ultimate Template Builder for Elementor vtrunk
trunk 2.2.10 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 2.3.0 2.3.1 2.3.2 2.3.3 2.3.4
enteraddons / widgets / counter / Counter.php

Counter.php in Enter Addons – Ultimate Template Builder for Elementor trunk, at widgets/counter/Counter.php

927 lines 34.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Enteraddons\Widgets\Counter;
3
4 use Elementor\Widget_Base;
5 use Elementor\Controls_Manager;
6 use Elementor\Scheme_Color;
7 use Elementor\Scheme_Typography;
8 use Elementor\Group_Control_Typography;
9 use Elementor\Group_Control_Box_Shadow;
10 use Elementor\Group_Control_Background;
11 use Elementor\Group_Control_Border;
12
13 // Exit if accessed directly
14 if ( ! defined( 'ABSPATH' ) ) {
15 exit;
16 }
17
18 /**
19 *
20 * Enteraddons elementor Counter widget.
21 *
22 * @since 1.0
23 */
24 class Counter extends Widget_Base {
25
26 public function get_name() {
27 return 'enteraddons-counter';
28 }
29
30 public function get_title() {
31 return esc_html__( 'Counter', 'enteraddons' );
32 }
33
34 public function get_icon() {
35 return 'entera entera-counter';
36 }
37
38 public function get_categories() {
39 return ['enteraddons-elements-category'];
40 }
41
42 protected function register_controls() {
43
44 //------------------------------ Counter Style ------------------------------
45 $this->start_controls_section(
46 'enteraddons_counter_layout', [
47 'label' => esc_html__( 'Layout', 'enteraddons' )
48 ]
49 );
50 $this->add_control(
51 'icon_position',
52 [
53 'label' => esc_html__( 'Icon Position', 'enteraddons' ),
54 'type' => \Elementor\Controls_Manager::SELECT,
55 'options' => [
56 'top' => esc_html__( 'Content Top', 'enteraddons' ),
57 'bottom' => esc_html__( 'Content Bottom', 'enteraddons' ),
58 'left' => esc_html__( 'Content Left', 'enteraddons' ),
59 'right' => esc_html__( 'Content Right', 'enteraddons' )
60 ],
61 'default' => 'top'
62 ]
63 );
64 $this->add_control(
65 'number_position',
66 [
67 'label' => esc_html__( 'Number Position', 'enteraddons' ),
68 'type' => \Elementor\Controls_Manager::SELECT,
69 'options' => [
70 'before' => esc_html__( 'Before Title', 'enteraddons' ),
71 'after' => esc_html__( 'After Title', 'enteraddons' )
72 ],
73 'default' => 'before'
74 ]
75 );
76 $this->add_responsive_control(
77 'item_alignment',
78 [
79 'label' => esc_html__( 'Content Alignment', 'enteraddons' ),
80 'type' => \Elementor\Controls_Manager::CHOOSE,
81 'options' => [
82 'left' => [
83 'title' => esc_html__( 'Left', 'enteraddons' ),
84 'icon' => 'eicon-text-align-left',
85 ],
86 'center' => [
87 'title' => esc_html__( 'Center', 'enteraddons' ),
88 'icon' => 'eicon-text-align-center',
89 ],
90 'right' => [
91 'title' => esc_html__( 'Right', 'enteraddons' ),
92 'icon' => 'eicon-text-align-right',
93 ],
94 ],
95 'default' => 'center',
96 'toggle' => true,
97 'selectors' => [
98 '{{WRAPPER}} .enteraddons-single-counter' => 'text-align: {{VALUE}} !important',
99 ],
100 ]
101 );
102 $this->add_control(
103 'item_flex_alignment',
104 [
105 'label' => esc_html__( 'Flex Alignment', 'enteraddons' ),
106 'type' => \Elementor\Controls_Manager::CHOOSE,
107 'options' => [
108 'flex-start' => [
109 'title' => esc_html__( 'Start', 'enteraddons' ),
110 'icon' => 'eicon-h-align-left',
111 ],
112 'center' => [
113 'title' => esc_html__( 'Center', 'enteraddons' ),
114 'icon' => 'eicon-h-align-center',
115 ],
116 'flex-end' => [
117 'title' => esc_html__( 'End', 'enteraddons' ),
118 'icon' => 'eicon-h-align-right',
119 ],
120 ],
121 'default' => 'center',
122 'condition' => [ 'icon_position' => ['left','right'] ],
123 'toggle' => true,
124 'selectors' => [
125 '{{WRAPPER}} .enteraddons-single-counter' => 'justify-content: {{VALUE}} !important',
126 ],
127 ]
128 );
129 $this->end_controls_section();
130
131 // ---------------------------------------- Counter Title content ------------------------------
132 $this->start_controls_section(
133 'enteraddons_counter_content_title',
134 [
135 'label' => esc_html__( 'Title', 'enteraddons' ),
136 ]
137 );
138
139 $this->add_control(
140 'title',
141 [
142 'label' => esc_html__( 'Title', 'enteraddons' ),
143 'type' => \Elementor\Controls_Manager::TEXT,
144 'dynamic' => [
145 'active' => true,
146 ],
147 'label_block' => true,
148 'default' => 'Happy Clients'
149 ]
150 );
151 $this->add_control(
152 'title_tag',
153 [
154 'label' => esc_html__( 'Set HTML Tag', 'enteraddons' ),
155 'type' => \Elementor\Controls_Manager::SELECT,
156 'options' => [
157 'h1' => 'H1',
158 'h2' => 'H2',
159 'h3' => 'H3',
160 'h4' => 'H4',
161 'h5' => 'H5',
162 'h6' => 'H6',
163 'span' => 'span',
164 'p' => 'p',
165 'div' => 'div'
166 ],
167 'default' => 'p'
168 ]
169 );
170
171 $this->end_controls_section(); // End Team content
172 // ---------------------------------------- Counter Number content ------------------------------
173 $this->start_controls_section(
174 'enteraddons_counter_content_number',
175 [
176 'label' => esc_html__( 'Number', 'enteraddons' ),
177 ]
178 );
179
180 $this->add_control(
181 'number',
182 [
183 'label' => esc_html__( 'Number', 'enteraddons' ),
184 'type' => \Elementor\Controls_Manager::TEXT,
185 'dynamic' => [
186 'active' => true,
187 ],
188 'label_block' => true,
189 'default' => '285'
190 ]
191 );
192 $this->add_control(
193 'number_unit',
194 [
195 'label' => esc_html__( 'Number Unit', 'enteraddons' ),
196 'type' => \Elementor\Controls_Manager::TEXT,
197 'dynamic' => [
198 'active' => true,
199 ],
200 'default' => ''
201 ]
202 );
203 $this->add_control(
204 'number_tag',
205 [
206 'label' => esc_html__( 'Set HTML Tag', 'enteraddons' ),
207 'type' => \Elementor\Controls_Manager::SELECT,
208 'options' => [
209 'h1' => 'H1',
210 'h2' => 'H2',
211 'h3' => 'H3',
212 'h4' => 'H4',
213 'h5' => 'H5',
214 'h6' => 'H6',
215 'span' => 'span',
216 'p' => 'p',
217 'div' => 'div'
218 ],
219 'default' => 'h2'
220 ]
221 );
222
223 $this->end_controls_section(); // End Counter content
224
225 // ---------------------------------------- Counter Icon content ------------------------------
226 $this->start_controls_section(
227 'enteraddons_counter_content_icon',
228 [
229 'label' => esc_html__( 'Icon', 'enteraddons' ),
230 ]
231 );
232 $this->add_control(
233 'icon_show',
234 [
235 'label' => esc_html__( 'Show Icon', 'enteraddons' ),
236 'type' => \Elementor\Controls_Manager::SWITCHER,
237 'label_on' => esc_html__( 'Yes', 'enteraddons' ),
238 'label_off' => esc_html__( 'No', 'enteraddons' ),
239 'return_value' => 'yes',
240 'default' => 'no',
241 ]
242 );
243 $this->add_control(
244 'icon_type',
245 [
246 'label' => esc_html__( 'Icon Type', 'enteraddons' ),
247 'type' => \Elementor\Controls_Manager::SELECT,
248 'options' => [
249 'icon' => 'Icon',
250 'img' => 'Image'
251 ],
252 'default' => 'icon',
253 'condition' => [ 'icon_show' => 'yes' ]
254 ]
255 );
256 $this->add_control(
257 'icon',
258 [
259 'label' => esc_html__( 'Icons', 'enteraddons' ),
260 'type' => \Elementor\Controls_Manager::ICONS,
261 'default' => [
262 'value' => 'far fa-smile',
263 'library' => 'fa-solid',
264 ],
265 'condition' => [
266 'icon_type' => 'icon',
267 'icon_show' => 'yes'
268 ]
269 ]
270 );
271 $this->add_control(
272 'image',
273 [
274 'label' => esc_html__( 'Image', 'enteraddons' ),
275 'type' => \Elementor\Controls_Manager::MEDIA,
276 'dynamic' => [
277 'active' => true,
278 ],
279 'condition' => [
280 'icon_type' => 'img',
281 'icon_show' => 'yes'
282 ],
283 'default' => [
284 'url' => \Elementor\Utils::get_placeholder_image_src(),
285 ],
286 ]
287 );
288 $this->end_controls_section(); // End Counter content
289
290
291 /**
292 * Style Tab
293 * ------------------------------ Item Content Wrapper Style ------------------------------
294 *
295 */
296 $this->start_controls_section(
297 'enteraddons_Counter_wrapper_style_settings', [
298 'label' => esc_html__( 'Item Wrapper Settings', 'enteraddons' ),
299 'tab' => Controls_Manager::TAB_STYLE,
300 ]
301 );
302
303 $this->start_controls_tabs( 'tab_counter_wrapper' );
304
305 // Controls tab For Normal
306 $this->start_controls_tab(
307 'item_wrapper_normal',
308 [
309 'label' => esc_html__( 'Normal', 'enteraddons' ),
310 ]
311 );
312
313 $this->add_responsive_control(
314 'item_margin',
315 [
316 'label' => esc_html__( 'Margin', 'enteraddons' ),
317 'type' => Controls_Manager::DIMENSIONS,
318 'devices' => [ 'desktop', 'tablet', 'mobile' ],
319 'size_units' => [ 'px', '%', 'em' ],
320 'selectors' => [
321 '{{WRAPPER}} .enteraddons-single-counter' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
322 ],
323 ]
324 );
325 $this->add_responsive_control(
326 'item_padding',
327 [
328 'label' => esc_html__( 'Padding', 'enteraddons' ),
329 'type' => Controls_Manager::DIMENSIONS,
330 'devices' => [ 'desktop', 'tablet', 'mobile' ],
331 'size_units' => [ 'px', '%', 'em' ],
332 'selectors' => [
333 '{{WRAPPER}} .enteraddons-single-counter' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
334 ],
335 ]
336 );
337 $this->add_group_control(
338 \Elementor\Group_Control_Border::get_type(),
339 [
340 'name' => 'item_border',
341 'label' => esc_html__( 'Border', 'enteraddons' ),
342 'selector' => '{{WRAPPER}} .enteraddons-single-counter',
343 ]
344 );
345 $this->add_responsive_control(
346 'item_radius',
347 [
348 'label' => esc_html__( 'Border Radius', 'enteraddons' ),
349 'type' => Controls_Manager::DIMENSIONS,
350 'devices' => [ 'desktop', 'tablet', 'mobile' ],
351 'size_units' => [ 'px', '%', 'em' ],
352 'selectors' => [
353 '{{WRAPPER}} .enteraddons-single-counter' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
354 ],
355 ]
356 );
357 $this->add_group_control(
358 \Elementor\Group_Control_Box_Shadow::get_type(),
359 [
360 'name' => 'item_shadow',
361 'label' => esc_html__( 'Box Shadow', 'enteraddons' ),
362 'selector' => '{{WRAPPER}} .enteraddons-single-counter',
363 ]
364 );
365 $this->add_group_control(
366 \Elementor\Group_Control_Background::get_type(),
367 [
368 'name' => 'item_background',
369 'label' => esc_html__( 'Background', 'enteraddons' ),
370 'types' => [ 'classic', 'gradient' ],
371 'selector' => '{{WRAPPER}} .enteraddons-single-counter',
372 ]
373 );
374
375 $this->end_controls_tab(); // End Controls tab
376
377 // Controls tab For Hover
378 $this->start_controls_tab(
379 'item_hover',
380 [
381 'label' => esc_html__( 'Hover', 'enteraddons' ),
382 ]
383 );
384 $this->add_group_control(
385 \Elementor\Group_Control_Border::get_type(),
386 [
387 'name' => 'item_hover_border',
388 'label' => esc_html__( 'Border', 'enteraddons' ),
389 'selector' => '{{WRAPPER}} .enteraddons-single-counter:hover',
390 ]
391 );
392 $this->add_responsive_control(
393 'item_hover_radius',
394 [
395 'label' => esc_html__( 'Border Radius', 'enteraddons' ),
396 'type' => Controls_Manager::DIMENSIONS,
397 'devices' => [ 'desktop', 'tablet', 'mobile' ],
398 'size_units' => [ 'px', '%', 'em' ],
399 'selectors' => [
400 '{{WRAPPER}} .enteraddons-single-counter:hover' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
401 ],
402 ]
403 );
404 $this->add_group_control(
405 \Elementor\Group_Control_Box_Shadow::get_type(),
406 [
407 'name' => 'item_hover_shadow',
408 'label' => esc_html__( 'Box Shadow', 'enteraddons' ),
409 'selector' => '{{WRAPPER}} .enteraddons-single-counter:hover',
410 ]
411 );
412 $this->add_group_control(
413 \Elementor\Group_Control_Background::get_type(),
414 [
415 'name' => 'item_hover_background',
416 'label' => esc_html__( 'Background', 'enteraddons' ),
417 'types' => [ 'classic', 'gradient' ],
418 'selector' => '{{WRAPPER}} .enteraddons-single-counter:hover',
419 ]
420 );
421
422
423 $this->end_controls_tab(); // End Controls tab
424
425 $this->end_controls_tabs(); // end controls tabs section
426
427 $this->end_controls_section();
428
429 //------------------------------ Title Style ------------------------------
430 $this->start_controls_section(
431 'enteraddons_counter_title_style', [
432 'label' => esc_html__( 'Title', 'enteraddons' ),
433 'tab' => Controls_Manager::TAB_STYLE,
434 ]
435 );
436
437 $this->start_controls_tabs( 'tab_counter_title' );
438
439 // Controls tab For Normal
440 $this->start_controls_tab(
441 'item_title_normal',
442 [
443 'label' => esc_html__( 'Normal', 'enteraddons' ),
444 ]
445 );
446 $this->add_control(
447 'title_color',
448 [
449 'label' => esc_html__( 'Title Color', 'enteraddons' ),
450 'type' => \Elementor\Controls_Manager::COLOR,
451 'selectors' => [
452 '{{WRAPPER}} .enteraddons-single-counter .enteraddons-counter-title' => 'color: {{VALUE}}',
453 ],
454 ]
455 );
456 $this->add_group_control(
457 \Elementor\Group_Control_Typography::get_type(),
458 [
459 'name' => 'title_typography',
460 'label' => esc_html__( 'Typography', 'enteraddons' ),
461 'selector' => '{{WRAPPER}} .enteraddons-single-counter .enteraddons-counter-title',
462 ]
463 );
464 $this->add_responsive_control(
465 'title_margin',
466 [
467 'label' => esc_html__( 'Margin', 'enteraddons' ),
468 'type' => Controls_Manager::DIMENSIONS,
469 'devices' => [ 'desktop', 'tablet', 'mobile' ],
470 'size_units' => [ 'px', '%', 'em' ],
471 'selectors' => [
472 '{{WRAPPER}} .enteraddons-single-counter .enteraddons-counter-title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
473 ],
474 ]
475 );
476 $this->add_responsive_control(
477 'title_padding',
478 [
479 'label' => esc_html__( 'Padding', 'enteraddons' ),
480 'type' => Controls_Manager::DIMENSIONS,
481 'devices' => [ 'desktop', 'tablet', 'mobile' ],
482 'size_units' => [ 'px', '%', 'em' ],
483 'selectors' => [
484 '{{WRAPPER}} .enteraddons-single-counter .enteraddons-counter-title' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
485 ],
486 ]
487 );
488
489 $this->end_controls_tab(); // End Controls tab
490
491 // Controls tab For Hover
492 $this->start_controls_tab(
493 'item_title_hover',
494 [
495 'label' => esc_html__( 'Hover', 'enteraddons' ),
496 ]
497 );
498 $this->add_control(
499 'title_hover_color',
500 [
501 'label' => esc_html__( 'Title Color', 'enteraddons' ),
502 'type' => \Elementor\Controls_Manager::COLOR,
503 'selectors' => [
504 '{{WRAPPER}} .enteraddons-single-counter:hover .enteraddons-counter-title' => 'color: {{VALUE}}',
505 ],
506 ]
507 );
508
509 $this->end_controls_tab(); // End Controls tab
510
511 $this->end_controls_tabs(); // end controls tabs section
512
513 $this->end_controls_section();
514
515 //------------------------------ Number Style ------------------------------
516 $this->start_controls_section(
517 'enteraddons_counter_nuber_style', [
518 'label' => esc_html__( 'Number', 'enteraddons' ),
519 'tab' => Controls_Manager::TAB_STYLE,
520 ]
521 );
522
523 $this->start_controls_tabs( 'tab_counter_number' );
524
525 // Controls tab For Normal
526 $this->start_controls_tab(
527 'item_number_normal',
528 [
529 'label' => esc_html__( 'Normal', 'enteraddons' ),
530 ]
531 );
532 $this->add_control(
533 'number_color',
534 [
535 'label' => esc_html__( 'Number Color', 'enteraddons' ),
536 'type' => \Elementor\Controls_Manager::COLOR,
537 'selectors' => [
538 '{{WRAPPER}} .enteraddons-single-counter .enteraddons-counter-number .enteraddons-count' => 'color: {{VALUE}}',
539 ],
540 ]
541 );
542 $this->add_control(
543 'number_unit_color',
544 [
545 'label' => esc_html__( 'Unit Color', 'enteraddons' ),
546 'type' => \Elementor\Controls_Manager::COLOR,
547 'selectors' => [
548 '{{WRAPPER}} .enteraddons-single-counter .enteraddons-counter-number' => 'color: {{VALUE}}',
549 ],
550 ]
551 );
552 $this->add_group_control(
553 \Elementor\Group_Control_Typography::get_type(),
554 [
555 'name' => 'number_typography',
556 'label' => esc_html__( 'Typography', 'enteraddons' ),
557 'selector' => '{{WRAPPER}} .enteraddons-single-counter .enteraddons-counter-number',
558 ]
559 );
560 $this->add_responsive_control(
561 'number_margin',
562 [
563 'label' => esc_html__( 'Margin', 'enteraddons' ),
564 'type' => Controls_Manager::DIMENSIONS,
565 'devices' => [ 'desktop', 'tablet', 'mobile' ],
566 'size_units' => [ 'px', '%', 'em' ],
567 'selectors' => [
568 '{{WRAPPER}} .enteraddons-single-counter .enteraddons-counter-number' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
569 ],
570 ]
571 );
572 $this->add_responsive_control(
573 'number_padding',
574 [
575 'label' => esc_html__( 'Padding', 'enteraddons' ),
576 'type' => Controls_Manager::DIMENSIONS,
577 'devices' => [ 'desktop', 'tablet', 'mobile' ],
578 'size_units' => [ 'px', '%', 'em' ],
579 'selectors' => [
580 '{{WRAPPER}} .enteraddons-single-counter .enteraddons-counter-number' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
581 ],
582 ]
583 );
584
585 $this->end_controls_tab(); // End Controls tab
586
587 // Controls tab For Hover
588 $this->start_controls_tab(
589 'item_number_hover',
590 [
591 'label' => esc_html__( 'Hover', 'enteraddons' ),
592 ]
593 );
594 $this->add_control(
595 'number_hover_color',
596 [
597 'label' => esc_html__( 'Number Color', 'enteraddons' ),
598 'type' => \Elementor\Controls_Manager::COLOR,
599 'selectors' => [
600 '{{WRAPPER}} .enteraddons-single-counter:hover .enteraddons-counter-number .enteraddons-count' => 'color: {{VALUE}}',
601 ],
602 ]
603 );
604 $this->add_control(
605 'number_unit_hover_color',
606 [
607 'label' => esc_html__( 'Unit Hover Color', 'enteraddons' ),
608 'type' => \Elementor\Controls_Manager::COLOR,
609 'selectors' => [
610 '{{WRAPPER}} .enteraddons-single-counter:hover .enteraddons-counter-number' => 'color: {{VALUE}}',
611 ],
612 ]
613 );
614
615 $this->end_controls_tab(); // End Controls tab
616
617 $this->end_controls_tabs(); // end controls tabs section
618
619 $this->end_controls_section();
620
621 //------------------------------ Counter Icon Style ------------------------------
622 $this->start_controls_section(
623 'enteraddons_counter_icon_style', [
624 'label' => esc_html__( 'Icon', 'enteraddons' ),
625 'tab' => Controls_Manager::TAB_STYLE,
626 'condition' => [ 'icon_show' => 'yes' ]
627 ]
628 );
629 $this->start_controls_tabs( 'tab_counter_icon' );
630
631 // Controls tab For Normal
632 $this->start_controls_tab(
633 'item_counter_icon_normal',
634 [
635 'label' => esc_html__( 'Normal', 'enteraddons' ),
636 ]
637 );
638 // This field work on icon type icon
639 $this->add_control(
640 'icon_color',
641 [
642 'label' => esc_html__( 'Icon Color', 'enteraddons' ),
643 'type' => \Elementor\Controls_Manager::COLOR,
644 'selectors' => [
645 '{{WRAPPER}} .enteraddons-counter-icon i' => 'color: {{VALUE}}',
646 ],
647 'condition' => [ 'icon_type' => 'icon' ]
648 ]
649 );
650 $this->add_responsive_control(
651 'counter_icon_size',
652 [
653 'label' => esc_html__( 'Icon Size', 'enteraddons' ),
654 'type' => Controls_Manager::SLIDER,
655 'size_units' => [ 'px', '%' ],
656 'range' => [
657 'px' => [
658 'min' => 0,
659 'max' => 300,
660 'step' => 1,
661 ],
662 '%' => [
663 'min' => 0,
664 'max' => 100,
665 ],
666 ],
667 'default' => [
668 'unit' => '%',
669 'size' => '',
670 ],
671 'selectors' => [
672 '{{WRAPPER}} .enteraddons-counter-icon i ' => 'font-size: {{SIZE}}{{UNIT}};',
673 '{{WRAPPER}} .enteraddons-counter-icon img ' => 'width: {{SIZE}}{{UNIT}};',
674 ],
675 'condition' => [ 'icon_type' => 'icon' ]
676 ]
677 );
678 $this->add_responsive_control(
679 'icon_wrapper_width',
680 [
681 'label' => esc_html__( 'Icon Wrapper Width', 'enteraddons' ),
682 'type' => Controls_Manager::SLIDER,
683 'size_units' => [ 'px', '%' ],
684 'range' => [
685 'px' => [
686 'min' => 0,
687 'max' => 1000,
688 'step' => 1,
689 ],
690 '%' => [
691 'min' => 0,
692 'max' => 100,
693 ],
694 ],
695 'default' => [
696 'unit' => '%',
697 'size' => '',
698 ],
699 'selectors' => [
700 '{{WRAPPER}} .enteraddons-counter-icon' => 'width: {{SIZE}}{{UNIT}};',
701 ],
702 ]
703 );
704 $this->add_responsive_control(
705 'icon_wrapper_height',
706 [
707 'label' => esc_html__( 'Icon Wrapper Height', 'enteraddons' ),
708 'type' => Controls_Manager::SLIDER,
709 'size_units' => [ 'px', '%' ],
710 'range' => [
711 'px' => [
712 'min' => 0,
713 'max' => 1000,
714 'step' => 1,
715 ],
716 '%' => [
717 'min' => 0,
718 'max' => 100,
719 ],
720 ],
721 'default' => [
722 'unit' => '%',
723 'size' => '',
724 ],
725 'selectors' => [
726 '{{WRAPPER}} .enteraddons-counter-icon' => 'height: {{SIZE}}{{UNIT}};',
727 ],
728 ]
729 );
730 $this->add_responsive_control(
731 'icon_image_width',
732 [
733 'label' => esc_html__( 'Image Width', 'enteraddons' ),
734 'type' => Controls_Manager::SLIDER,
735 'size_units' => [ 'px', '%' ],
736 'range' => [
737 'px' => [
738 'min' => 0,
739 'max' => 1000,
740 'step' => 1,
741 ],
742 '%' => [
743 'min' => 0,
744 'max' => 100,
745 ],
746 ],
747 'default' => [
748 'unit' => '%',
749 'size' => '',
750 ],
751 'selectors' => [
752 '{{WRAPPER}} .enteraddons-counter-icon img' => 'width: {{SIZE}}{{UNIT}};',
753 ],
754 'condition' => [ 'icon_type' => 'img' ]
755 ]
756 );
757 $this->add_responsive_control(
758 'icon_image_height',
759 [
760 'label' => esc_html__( 'Image Height', 'enteraddons' ),
761 'type' => Controls_Manager::SLIDER,
762 'size_units' => [ 'px', '%' ],
763 'range' => [
764 'px' => [
765 'min' => 0,
766 'max' => 1000,
767 'step' => 1,
768 ],
769 '%' => [
770 'min' => 0,
771 'max' => 100,
772 ],
773 ],
774 'default' => [
775 'unit' => '%',
776 'size' => '',
777 ],
778 'selectors' => [
779 '{{WRAPPER}} .enteraddons-counter-icon img' => 'height: {{SIZE}}{{UNIT}};',
780 ],
781 'condition' => [ 'icon_type' => 'img' ]
782 ]
783 );
784 $this->add_responsive_control(
785 'img_margin',
786 [
787 'label' => esc_html__( 'Margin', 'enteraddons' ),
788 'type' => Controls_Manager::DIMENSIONS,
789 'devices' => [ 'desktop', 'tablet', 'mobile' ],
790 'size_units' => [ 'px', '%', 'em' ],
791 'selectors' => [
792 '{{WRAPPER}} .enteraddons-counter-icon' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
793 ],
794 ]
795 );
796 $this->add_responsive_control(
797 'img_padding',
798 [
799 'label' => esc_html__( 'Padding', 'enteraddons' ),
800 'type' => Controls_Manager::DIMENSIONS,
801 'devices' => [ 'desktop', 'tablet', 'mobile' ],
802 'size_units' => [ 'px', '%', 'em' ],
803 'selectors' => [
804 '{{WRAPPER}} .enteraddons-counter-icon' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
805 ],
806 ]
807 );
808 $this->add_group_control(
809 \Elementor\Group_Control_Border::get_type(),
810 [
811 'name' => 'img_border',
812 'label' => esc_html__( 'Border', 'enteraddons' ),
813 'selector' => '{{WRAPPER}} .enteraddons-counter-icon',
814 ]
815 );
816 $this->add_responsive_control(
817 'img_border_radius',
818 [
819 'label' => esc_html__( 'Border Radius', 'enteraddons' ),
820 'type' => Controls_Manager::DIMENSIONS,
821 'devices' => [ 'desktop', 'tablet', 'mobile' ],
822 'size_units' => [ 'px', '%', 'em' ],
823 'selectors' => [
824 '{{WRAPPER}} .enteraddons-counter-icon' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
825 ],
826 ]
827 );
828 $this->add_group_control(
829 \Elementor\Group_Control_Box_Shadow::get_type(),
830 [
831 'name' => 'img_box_shadow',
832 'label' => esc_html__( 'Box Shadow', 'enteraddons' ),
833 'selector' => '{{WRAPPER}} .enteraddons-counter-icon',
834 ]
835 );
836 $this->add_group_control(
837 \Elementor\Group_Control_Background::get_type(),
838 [
839 'name' => 'image_background',
840 'label' => esc_html__( 'Background', 'enteraddons' ),
841 'types' => [ 'classic', 'gradient' ],
842 'selector' => '{{WRAPPER}} .enteraddons-counter-icon',
843 ]
844 );
845 $this->end_controls_tab(); // End Controls tab
846
847 // Controls tab For Hover
848 $this->start_controls_tab(
849 'icon_hover_tab',
850 [
851 'label' => esc_html__( 'Hover', 'enteraddons' ),
852 ]
853 );
854 $this->add_control(
855 'icon_hover_color',
856 [
857 'label' => esc_html__( 'Icon Color', 'enteraddons' ),
858 'type' => \Elementor\Controls_Manager::COLOR,
859 'condition' => [ 'icon_type' => 'icon' ],
860 'selectors' => [
861 '{{WRAPPER}} .enteraddons-single-counter:hover .enteraddons-counter-icon i' => 'color: {{VALUE}}',
862 ],
863 ]
864 );
865 $this->add_responsive_control(
866 'img_hover_border_radius',
867 [
868 'label' => esc_html__( 'Border Radius', 'enteraddons' ),
869 'type' => Controls_Manager::DIMENSIONS,
870 'devices' => [ 'desktop', 'tablet', 'mobile' ],
871 'size_units' => [ 'px', '%', 'em' ],
872 'selectors' => [
873 '{{WRAPPER}} .enteraddons-single-counter:hover .enteraddons-counter-icon' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
874 ],
875 ]
876 );
877 $this->add_group_control(
878 \Elementor\Group_Control_Box_Shadow::get_type(),
879 [
880 'name' => 'img_hover_box_shadow',
881 'label' => esc_html__( 'Box Shadow', 'enteraddons' ),
882 'selector' => '{{WRAPPER}} .enteraddons-single-counter:hover .enteraddons-counter-icon',
883 ]
884 );
885 $this->add_group_control(
886 \Elementor\Group_Control_Background::get_type(),
887 [
888 'name' => 'image_hover_background',
889 'label' => esc_html__( 'Background', 'enteraddons' ),
890 'types' => [ 'classic', 'gradient' ],
891 'selector' => '{{WRAPPER}} .enteraddons-single-counter:hover .enteraddons-counter-icon',
892 ]
893 );
894 $this->end_controls_tab(); // End Controls tab
895
896 $this->end_controls_tabs(); // end controls tabs section
897
898 $this->end_controls_section();
899
900
901
902
903 }
904
905 protected function render() {
906
907 // get settings
908 $settings = $this->get_settings_for_display();
909
910 // Tema template render
911 $obj = new Counter_Template();
912 $obj::setDisplaySettings( $settings );
913 $obj->renderTemplate();
914
915 }
916
917 public function get_script_depends() {
918 return [ 'enteraddons-main','waypoints','counterup'];
919 }
920
921 public function get_style_depends() {
922 return [ 'enteraddons-global-style' ];
923 }
924
925
926 }
927