PluginProbe
Master Addons for Elementor – Elementor Addons, Widgets, Mega Menu Builder, Popup Builder, Widget Builder & Template Kits / 3.1.2
Master Addons for Elementor – Elementor Addons, Widgets, Mega Menu Builder, Popup Builder, Widget Builder & Template Kits v3.1.2
3.2.2 3.2.3 3.2.1 3.2.0 3.1.9 3.1.8 3.1.7 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.9 trunk 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.3 1.1.4 1.1.5 All 174 releases
master-addons / addons / marketing / ma-calendar / ma-calendar.php

ma-calendar.php in Master Addons for Elementor – Elementor Addons, Widgets, Mega Menu Builder, Popup Builder, Widget Builder & Template Kits 3.1.2, at addons/marketing/ma-calendar/ma-calendar.php

2,876 lines 99.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace MasterAddons\Addons;
4
5 use Elementor\Controls_Manager;
6 use Elementor\Repeater;
7 use Elementor\Group_Control_Typography;
8 use Elementor\Group_Control_Text_Shadow;
9 use Elementor\Group_Control_Box_Shadow;
10 use Elementor\Group_Control_Border;
11 use Elementor\Group_Control_Background;
12 use Elementor\Core\Kits\Documents\Tabs\Global_Colors;
13 use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
14 use MasterAddons\Inc\Controls\Group\JLTMA_Transition;
15 use MasterAddons\Inc\Admin\Config;
16 use MasterAddons\Inc\Classes\Base\Master_Widget;
17 use MasterAddons\Inc\Classes\Utils;
18 use MasterAddons\Inc\Classes\Helper;
19
20 if (!defined('ABSPATH')) exit; // Exit if accessed directly
21
22 /**
23 * Stub class for CustomFieldsModule (not implemented)
24 */
25 if (!class_exists('MasterAddons\Addons\CustomFieldsModule')) {
26 class CustomFieldsModule {
27 public function get_field_types() { return []; }
28 public function get_component($type) { return null; }
29 }
30 }
31
32 /**
33 * Calendar
34 *
35 * @since 2.0.0
36 */
37 class Calendar extends Master_Widget
38 {
39 use \MasterAddons\Inc\Traits\Widget_Notice;
40 use \MasterAddons\Inc\Traits\Widget_Assets_Trait;
41
42 /**
43 * This widget displays dynamic content.
44 */
45 protected function is_dynamic_content(): bool {
46 return true;
47 }
48
49 /**
50 * _events
51 *
52 * @since 2.0.0
53 * @var array
54 */
55 protected $_events;
56
57 /**
58 * Get Name
59 *
60 * Get the name of the widget
61 *
62 * @since 2.0.0
63 * @return string
64 */
65 public function get_name()
66 {
67 return 'jltma-calendar';
68 }
69
70 /**
71 * Get Title
72 *
73 * Get the title of the widget
74 *
75 * @since 2.0.0
76 * @return string
77 */
78 public function get_title()
79 {
80 return __('Calendar', 'master-addons' );
81 }
82
83 /**
84 * Get Icon
85 *
86 * Get the name of the widget
87 *
88 * @since 2.0.0
89 * @return string
90 */
91 public function get_icon()
92 {
93 return 'jltma-icon ' . Config::get_addon_icon($this->get_name());
94 }
95
96 /**
97 * Get Script Depends
98 *
99 * A list of scripts that the widgets is depended in
100 *
101 * @since 2.0.0
102 * @return array
103 */
104 /**
105 * Register Widget Controls
106 *
107 * @return void
108 */
109 protected function register_controls()
110 {
111
112 $this->start_controls_section(
113 'section_sources',
114 [
115 'label' => __('Events', 'master-addons' ),
116 ]
117 );
118
119 $this->add_control(
120 'source',
121 [
122 'label' => __('Source', 'master-addons' ),
123 'type' => Controls_Manager::SELECT,
124 'default' => 'manual',
125 'options' => [
126 'manual' => __('Manual', 'master-addons' ),
127 'posts' => __('Posts', 'master-addons' ),
128 ],
129 ]
130 );
131
132 $repeater = new Repeater();
133
134 $repeater->add_control(
135 'title',
136 [
137 'label' => __('Title', 'master-addons' ),
138 'type' => Controls_Manager::TEXT,
139 'default' => __('Conference', 'master-addons' ),
140 ]
141 );
142
143 $repeater->add_control(
144 'link',
145 [
146 'label' => __('Link', 'master-addons' ),
147 'type' => Controls_Manager::URL,
148 'placeholder' => __('https://your-link.com', 'master-addons' ),
149 'default' => [
150 'url' => '',
151 ],
152 ]
153 );
154
155 $repeater->add_control(
156 'start',
157 [
158 'label' => __('Start Date', 'master-addons' ),
159 'type' => \Elementor\Controls_Manager::DATE_TIME,
160 'picker_options' => [
161 'enableTime' => false,
162 ],
163 'default' => wp_date('Y-m-d H:i', strtotime('+1 day') + (get_option('gmt_offset') * HOUR_IN_SECONDS)),
164 ]
165 );
166
167 $repeater->add_control(
168 'end',
169 [
170 'label' => __('End Date', 'master-addons' ),
171 'type' => \Elementor\Controls_Manager::DATE_TIME,
172 'picker_options' => [
173 'enableTime' => false,
174 ],
175 'default' => wp_date('Y-m-d H:i', strtotime('+3 day') + (get_option('gmt_offset') * HOUR_IN_SECONDS)),
176 ]
177 );
178
179 $this->add_control(
180 'events',
181 [
182 'type' => Controls_Manager::REPEATER,
183 'default' => [
184 [],
185 ],
186 'fields' => $repeater->get_controls(),
187 'title_field' => '{{{ title }}}',
188 'condition' => [
189 'source' => 'manual',
190 ],
191 ]
192 );
193
194 $this->add_control(
195 'post_type',
196 [
197 'label' => __('Post Type', 'master-addons' ),
198 'type' => Controls_Manager::SELECT,
199 'default' => 'post',
200 'condition' => [
201 'source' => 'posts',
202 ],
203 'options' => Helper::ma_el_get_post_types(),
204 ]
205 );
206
207 $customfields = new CustomFieldsModule();
208
209 $this->add_control(
210 'post_dates_field_type',
211 [
212 'label' => __('Fetch Dates From', 'master-addons' ),
213 'type' => Controls_Manager::SELECT,
214 'default' => 'post_date',
215 'condition' => [
216 'source' => 'posts',
217 ],
218 'options' => array_merge(
219 ['post_date' => __('Post Date', 'master-addons' ),],
220 $customfields->get_field_types()
221 ),
222 ]
223 );
224
225 foreach (Helper::ma_el_get_post_types() as $post_type => $label) {
226 $post_type_label = $label;
227 foreach ($customfields->get_field_types() as $field_type => $label) {
228
229 $fields_options = [
230 'placeholder' => /* translators: %s: Date. */ sprintf(__('Search %s Date Fields', 'master-addons' ), $post_type_label),
231 'description' => /* translators: %s: Field Name. */ sprintf(__('Search %s fields by label or name', 'master-addons' ), strtolower($field_type)),
232 'type' => 'jltma-query',
233 'options' => [],
234 'label_block' => false,
235 'multiple' => false,
236 'post_type' => $post_type,
237 'query_type' => $field_type,
238 'query_options' => [
239 'field_type' => [
240 'date',
241 ],
242 'show_group' => true,
243 ],
244 'condition' => [
245 'source' => 'posts',
246 'post_dates_field_type' => $field_type,
247 'post_type' => $post_type,
248 ],
249 ];
250
251 $this->add_control(
252 'post_start_date_' . $field_type . '_' . $post_type,
253 array_merge($fields_options, ['label' => __('Start Date', 'master-addons' ),])
254 );
255
256 $this->add_control(
257 'post_end_date_' . $field_type . '_' . $post_type,
258 array_merge($fields_options, ['label' => __('End Date', 'master-addons' ),])
259 );
260 }
261 }
262
263 $this->add_control(
264 'no_events',
265 [
266 'label' => __('Handle No Events', 'master-addons' ),
267 'separator' => 'before',
268 'type' => Controls_Manager::SELECT,
269 'default' => '',
270 'options' => [
271 '' => __('Show Calendar', 'master-addons' ),
272 'hide' => __('Hide Calendar', 'master-addons' ),
273 'message' => __('Show Message', 'master-addons' ),
274 ],
275 ]
276 );
277
278 $this->add_control(
279 'no_events_message',
280 [
281 'label' => __('Message', 'master-addons' ),
282 'type' => Controls_Manager::TEXT,
283 'default' => __('There are currently no available events.', 'master-addons' ),
284 'condition' => [
285 'no_events' => 'message',
286 ],
287 ]
288 );
289
290 $this->end_controls_section();
291
292 $this->start_controls_section(
293 'section_calendar',
294 [
295 'label' => __('Calendar', 'master-addons' ),
296 ]
297 );
298
299 $this->add_control(
300 'display_heading',
301 [
302 'label' => __('Display', 'master-addons' ),
303 'type' => \Elementor\Controls_Manager::HEADING,
304 ]
305 );
306
307 $this->add_control(
308 'skin',
309 [
310 'label' => __('Skin', 'master-addons' ),
311 'type' => Controls_Manager::SELECT,
312 'default' => 'default',
313 'options' => [
314 'default' => __('Default', 'master-addons' ),
315 'compact' => __('Compact', 'master-addons' ),
316 ],
317 'prefix_class' => 'jltma-calendar-skin--',
318 ]
319 );
320
321 $this->add_control(
322 'first_day',
323 [
324 'label' => __('First Day', 'master-addons' ),
325 'type' => Controls_Manager::SELECT,
326 'default' => '1',
327 'options' => [
328 '0' => __('Sunday', 'master-addons' ),
329 '1' => __('Monday', 'master-addons' ),
330 '2' => __('Tuesday', 'master-addons' ),
331 '3' => __('Wednesday', 'master-addons' ),
332 '4' => __('Thursday', 'master-addons' ),
333 '5' => __('Friday', 'master-addons' ),
334 '6' => __('Saturday', 'master-addons' ),
335 ],
336 'frontend_available' => true
337 ]
338 );
339
340 $this->add_control(
341 'constrain_start',
342 [
343 'label' => __('Earliest Month', 'master-addons' ),
344 'type' => \Elementor\Controls_Manager::DATE_TIME,
345 'picker_options' => [
346 'enableTime' => false,
347 'dateFormat' => 'Y-m',
348 ],
349 'label_block' => false,
350 'default' => '',
351 'frontend_available' => true,
352 ]
353 );
354
355 $this->add_control(
356 'constrain_end',
357 [
358 'label' => __('Latest Month', 'master-addons' ),
359 'type' => \Elementor\Controls_Manager::DATE_TIME,
360 'picker_options' => [
361 'enableTime' => false,
362 'dateFormat' => 'Y-m',
363 ],
364 'label_block' => false,
365 'default' => '',
366 'frontend_available' => true,
367 ]
368 );
369
370 $this->add_control(
371 'default_current_month',
372 [
373 'label' => __('Default to Current Month', 'master-addons' ),
374 'type' => Controls_Manager::SWITCHER,
375 'default' => 'yes',
376 'label_on' => __('Yes', 'master-addons' ),
377 'label_off' => __('No', 'master-addons' ),
378 'frontend_available' => true,
379 ]
380 );
381
382 $this->add_control(
383 'default_month',
384 [
385 'label' => __('Default Month', 'master-addons' ),
386 'type' => \Elementor\Controls_Manager::DATE_TIME,
387 'picker_options' => [
388 'enableTime' => false,
389 'dateFormat' => 'Y-m',
390 ],
391 'condition' => [
392 'default_current_month' => ''
393 ],
394 'label_block' => false,
395 'default' => '',
396 'frontend_available' => true,
397 ]
398 );
399
400 $this->add_control(
401 'show_adjacent_months',
402 [
403 'label' => __('Show Adjacent Days', 'master-addons' ),
404 'type' => Controls_Manager::SWITCHER,
405 'default' => 'yes',
406 'label_on' => __('Yes', 'master-addons' ),
407 'label_off' => __('No', 'master-addons' ),
408 'frontend_available' => true,
409 ]
410 );
411
412 $this->add_control(
413 'navigation_heading',
414 [
415 'label' => __('Navigation', 'master-addons' ),
416 'type' => \Elementor\Controls_Manager::HEADING,
417 'separator' => 'before',
418 ]
419 );
420
421 $this->add_control(
422 'click_adjacent',
423 [
424 'label' => __('Adjacent Click', 'master-addons' ),
425 'description' => __('Clicking on days adjacent to current month navigates to corresponding month', 'master-addons' ),
426 'type' => Controls_Manager::SWITCHER,
427 'default' => '',
428 'label_on' => __('Yes', 'master-addons' ),
429 'label_off' => __('No', 'master-addons' ),
430 'condition' => [
431 'show_adjacent_months!' => '',
432 ],
433 'frontend_available' => true,
434 ]
435 );
436
437 $this->add_control(
438 'links_heading',
439 [
440 'label' => __('Links', 'master-addons' ),
441 'type' => \Elementor\Controls_Manager::HEADING,
442 'separator' => 'before',
443 'condition' => [
444 'source' => 'posts',
445 ],
446 ]
447 );
448
449 $this->add_control(
450 'link',
451 [
452 'label' => __('Enable Links', 'master-addons' ),
453 'type' => Controls_Manager::SWITCHER,
454 'default' => 'yes',
455 'label_on' => __('Yes', 'master-addons' ),
456 'label_off' => __('No', 'master-addons' ),
457 'frontend_available' => true,
458 'condition' => [
459 'source' => 'posts',
460 ],
461 ]
462 );
463
464 $this->add_control(
465 'link_is_external',
466 [
467 'label' => __('Open in new window', 'master-addons' ),
468 'type' => Controls_Manager::SWITCHER,
469 'default' => '',
470 'label_on' => __('Yes', 'master-addons' ),
471 'label_off' => __('No', 'master-addons' ),
472 'frontend_available' => true,
473 'condition' => [
474 'source' => 'posts',
475 ],
476 ]
477 );
478
479 $this->add_control(
480 'link_no_follow',
481 [
482 'label' => __('Add nofollow', 'master-addons' ),
483 'type' => Controls_Manager::SWITCHER,
484 'default' => '',
485 'label_on' => __('Yes', 'master-addons' ),
486 'label_off' => __('No', 'master-addons' ),
487 'frontend_available' => true,
488 'condition' => [
489 'source' => 'posts',
490 ],
491 ]
492 );
493
494 $this->add_control(
495 'days_heading',
496 [
497 'label' => __('Days', 'master-addons' ),
498 'type' => \Elementor\Controls_Manager::HEADING,
499 'separator' => 'before',
500 ]
501 );
502
503 $this->add_control(
504 'day_monday',
505 [
506 'label' => __('Monday', 'master-addons' ),
507 'type' => Controls_Manager::TEXT,
508 'default' => __('Mon', 'master-addons' ),
509 'frontend_available' => true,
510 ]
511 );
512
513 $this->add_control(
514 'day_tuesday',
515 [
516 'label' => __('Tuesday', 'master-addons' ),
517 'type' => Controls_Manager::TEXT,
518 'default' => __('Tue', 'master-addons' ),
519 'frontend_available' => true,
520 ]
521 );
522
523 $this->add_control(
524 'day_wednesday',
525 [
526 'label' => __('Wednesday', 'master-addons' ),
527 'type' => Controls_Manager::TEXT,
528 'default' => __('Wed', 'master-addons' ),
529 'frontend_available' => true,
530 ]
531 );
532
533 $this->add_control(
534 'day_thursday',
535 [
536 'label' => __('Thursday', 'master-addons' ),
537 'type' => Controls_Manager::TEXT,
538 'default' => __('Thu', 'master-addons' ),
539 'frontend_available' => true,
540 ]
541 );
542
543 $this->add_control(
544 'day_friday',
545 [
546 'label' => __('Friday', 'master-addons' ),
547 'type' => Controls_Manager::TEXT,
548 'default' => __('Fri', 'master-addons' ),
549 'frontend_available' => true,
550 ]
551 );
552
553 $this->add_control(
554 'day_saturday',
555 [
556 'label' => __('Saturday', 'master-addons' ),
557 'type' => Controls_Manager::TEXT,
558 'default' => __('Sat', 'master-addons' ),
559 'frontend_available' => true,
560 ]
561 );
562
563 $this->add_control(
564 'day_sunday',
565 [
566 'label' => __('Sunday', 'master-addons' ),
567 'type' => Controls_Manager::TEXT,
568 'default' => __('Sun', 'master-addons' ),
569 'frontend_available' => true,
570 ]
571 );
572
573 $this->add_control(
574 'link_archive',
575 [
576 'label' => __('Link to Archive', 'master-addons' ),
577 'type' => Controls_Manager::SWITCHER,
578 'default' => 'yes',
579 'label_on' => __('Yes', 'master-addons' ),
580 'label_off' => __('No', 'master-addons' ),
581 'condition' => [
582 'source' => 'posts',
583 'post_dates_field_type' => 'post_date',
584 ],
585 'frontend_available' => true,
586 ]
587 );
588
589 $this->add_control(
590 'months_heading',
591 [
592 'label' => __('Months', 'master-addons' ),
593 'type' => \Elementor\Controls_Manager::HEADING,
594 'separator' => 'before',
595 ]
596 );
597
598 $this->add_control(
599 'month_january',
600 [
601 'label' => __('January', 'master-addons' ),
602 'type' => Controls_Manager::TEXT,
603 'default' => __('January', 'master-addons' ),
604 'frontend_available' => true,
605 ]
606 );
607
608 $this->add_control(
609 'month_february',
610 [
611 'label' => __('February', 'master-addons' ),
612 'type' => Controls_Manager::TEXT,
613 'default' => __('February', 'master-addons' ),
614 'frontend_available' => true,
615 ]
616 );
617
618 $this->add_control(
619 'month_march',
620 [
621 'label' => __('March', 'master-addons' ),
622 'type' => Controls_Manager::TEXT,
623 'default' => __('March', 'master-addons' ),
624 'frontend_available' => true,
625 ]
626 );
627
628 $this->add_control(
629 'month_april',
630 [
631 'label' => __('April', 'master-addons' ),
632 'type' => Controls_Manager::TEXT,
633 'default' => __('April', 'master-addons' ),
634 'frontend_available' => true,
635 ]
636 );
637
638 $this->add_control(
639 'month_may',
640 [
641 'label' => __('May', 'master-addons' ),
642 'type' => Controls_Manager::TEXT,
643 'default' => __('May', 'master-addons' ),
644 'frontend_available' => true,
645 ]
646 );
647
648 $this->add_control(
649 'month_june',
650 [
651 'label' => __('June', 'master-addons' ),
652 'type' => Controls_Manager::TEXT,
653 'default' => __('June', 'master-addons' ),
654 'frontend_available' => true,
655 ]
656 );
657
658 $this->add_control(
659 'month_july',
660 [
661 'label' => __('July', 'master-addons' ),
662 'type' => Controls_Manager::TEXT,
663 'default' => __('July', 'master-addons' ),
664 'frontend_available' => true,
665 ]
666 );
667
668 $this->add_control(
669 'month_august',
670 [
671 'label' => __('August', 'master-addons' ),
672 'type' => Controls_Manager::TEXT,
673 'default' => __('August', 'master-addons' ),
674 'frontend_available' => true,
675 ]
676 );
677
678 $this->add_control(
679 'month_september',
680 [
681 'label' => __('September', 'master-addons' ),
682 'type' => Controls_Manager::TEXT,
683 'default' => __('September', 'master-addons' ),
684 'frontend_available' => true,
685 ]
686 );
687
688 $this->add_control(
689 'month_october',
690 [
691 'label' => __('October', 'master-addons' ),
692 'type' => Controls_Manager::TEXT,
693 'default' => __('October', 'master-addons' ),
694 'frontend_available' => true,
695 ]
696 );
697
698 $this->add_control(
699 'month_november',
700 [
701 'label' => __('November', 'master-addons' ),
702 'type' => Controls_Manager::TEXT,
703 'default' => __('November', 'master-addons' ),
704 'frontend_available' => true,
705 ]
706 );
707
708 $this->add_control(
709 'month_december',
710 [
711 'label' => __('December', 'master-addons' ),
712 'type' => Controls_Manager::TEXT,
713 'default' => __('December', 'master-addons' ),
714 'frontend_available' => true,
715 ]
716 );
717
718 $this->add_control(
719 'events_heading',
720 [
721 'label' => __('Events List', 'master-addons' ),
722 'type' => \Elementor\Controls_Manager::HEADING,
723 'separator' => 'before',
724 ]
725 );
726
727 $this->add_control(
728 'event_order',
729 [
730 'label' => __('Order', 'master-addons' ),
731 'type' => Controls_Manager::SELECT,
732 'default' => 'ASC',
733 'options' => [
734 'ASC' => __('Ascending', 'master-addons' ),
735 'DESC' => __('Descending', 'master-addons' ),
736 ],
737 'condition' => [
738 'skin' => 'compact',
739 ],
740 ]
741 );
742
743 $this->add_control(
744 'event_list_heading',
745 [
746 'label' => __('Heading', 'master-addons' ),
747 'type' => Controls_Manager::TEXT,
748 'default' => __('Posts this month', 'master-addons' ),
749 'condition' => [
750 'skin' => 'compact',
751 ],
752 'frontend_available' => true,
753 ]
754 );
755
756 $this->add_control(
757 'event_title_wrap',
758 [
759 'label' => __('Title Wrapping', 'master-addons' ),
760 'type' => Controls_Manager::SELECT,
761 'default' => 'no-wrap',
762 'options' => [
763 'no-wrap' => __('Single Line', 'master-addons' ),
764 'wrap' => __('Wrap', 'master-addons' ),
765 ],
766 'prefix_class' => 'jltma-calendar-event-title--',
767 ]
768 );
769
770 $this->add_control(
771 'event_date_format',
772 [
773 'label' => __('Date Format', 'master-addons' ),
774 'type' => Controls_Manager::TEXT,
775 'description' => sprintf('<a href="https://momentjs.com/docs/#/displaying/format/" target="_blank">%s</a>', __('Documentation on ISO date and time formatting', 'master-addons' )),
776 'default' => 'MMMM Do',
777 'condition' => [
778 'skin' => 'compact',
779 ],
780 'frontend_available' => true,
781 ]
782 );
783
784 $this->end_controls_section();
785
786 $this->start_controls_section(
787 'section_style_calendar',
788 [
789 'label' => __('Calendar', 'master-addons' ),
790 'tab' => Controls_Manager::TAB_STYLE,
791 ]
792 );
793
794 $this->add_responsive_control(
795 'calendar_width',
796 [
797 'label' => __('Max. Width', 'master-addons' ),
798 'type' => Controls_Manager::SLIDER,
799 'range' => [
800 'px' => [
801 'min' => 300,
802 'max' => 1000,
803 'step' => 1,
804 ],
805 ],
806 'selectors' => [
807 '{{WRAPPER}} .ee-calendar' => 'max-width: {{SIZE}}px;',
808 ],
809 ]
810 );
811
812 $this->add_responsive_control(
813 'calendar_padding',
814 [
815 'label' => __('Padding', 'master-addons' ),
816 'type' => Controls_Manager::SLIDER,
817 'range' => [
818 'px' => [
819 'min' => 0,
820 'max' => 100,
821 'step' => 1,
822 ],
823 ],
824 'selectors' => [
825 '{{WRAPPER}} .ee-calendar' => 'padding: {{SIZE}}px;',
826 ],
827 ]
828 );
829
830 $this->add_responsive_control(
831 'calendar_spacing_horizontal',
832 [
833 'label' => __('Horizontal Spacing', 'master-addons' ),
834 'type' => Controls_Manager::SLIDER,
835 'range' => [
836 'px' => [
837 'min' => 0,
838 'max' => 50,
839 'step' => 1,
840 ],
841 ],
842 'selectors' => [
843 '{{WRAPPER}} .ee-calendar__cell__content' => 'padding-left: {{SIZE}}px; padding-right: {{SIZE}}px;',
844 ],
845 ]
846 );
847
848 $this->add_responsive_control(
849 'calendar_spacing_vertical',
850 [
851 'label' => __('Vertical Spacing', 'master-addons' ),
852 'type' => Controls_Manager::SLIDER,
853 'range' => [
854 'px' => [
855 'min' => 0,
856 'max' => 50,
857 'step' => 1,
858 ],
859 ],
860 'selectors' => [
861 '{{WRAPPER}} .ee-calendar__cell__content' => 'padding-top: {{SIZE}}px; padding-bottom: {{SIZE}}px;',
862 ],
863 ]
864 );
865
866 $this->add_responsive_control(
867 'calendar_align',
868 [
869 'label' => __('Align', 'master-addons' ),
870 'type' => Controls_Manager::CHOOSE,
871 'default' => 'center',
872 'options' => [
873 'left' => [
874 'title' => __('Left', 'master-addons' ),
875 'icon' => 'fa fa-align-left',
876 ],
877 'center' => [
878 'title' => __('Center', 'master-addons' ),
879 'icon' => 'fa fa-align-center',
880 ],
881 'right' => [
882 'title' => __('Right', 'master-addons' ),
883 'icon' => 'fa fa-align-right',
884 ],
885 ],
886 'selectors' => [
887 '{{WRAPPER}}' => 'text-align: {{VALUE}};',
888 ],
889 ]
890 );
891
892 $this->add_control(
893 'calendar_background_color',
894 [
895 'label' => __('Background Color', 'master-addons' ),
896 'type' => Controls_Manager::COLOR,
897 'default' => '',
898 'selectors' => [
899 '{{WRAPPER}} .clndr' => 'background-color: {{VALUE}};',
900 ],
901 ]
902 );
903
904 $this->add_responsive_control(
905 'calendar_border_radius',
906 [
907 'label' => __('Border Radius', 'master-addons' ),
908 'type' => Controls_Manager::SLIDER,
909 'range' => [
910 'px' => [
911 'min' => 0,
912 'max' => 20,
913 'step' => 1,
914 ],
915 ],
916 'selectors' => [
917 '{{WRAPPER}} .clndr,
918 {{WRAPPER}} .ee-calendar' => 'border-radius: {{SIZE}}px;',
919 ],
920 ]
921 );
922
923 $this->add_group_control(
924 Group_Control_Border::get_type(),
925 [
926 'name' => 'calendar_border',
927 'label' => __('Border', 'master-addons' ),
928 'selector' => '{{WRAPPER}} .ee-calendar',
929 ]
930 );
931
932 $this->add_group_control(
933 Group_Control_Box_Shadow::get_type(),
934 [
935 'name' => 'calendar_box_shadow',
936 'selector' => '{{WRAPPER}} .ee-calendar',
937 ]
938 );
939
940 $this->add_group_control(
941 Group_Control_Typography::get_type(),
942 [
943 'name' => 'calendar_typography',
944 'selector' => '{{WRAPPER}} .ee-calendar__cell__content',
945 'global' => [
946 'default' => Global_Typography::TYPOGRAPHY_TEXT,
947 ],
948 ]
949 );
950
951 $this->add_control(
952 'separators_heading',
953 [
954 'label' => __('Separators', 'master-addons' ),
955 'type' => \Elementor\Controls_Manager::HEADING,
956 'separator' => 'before',
957 ]
958 );
959
960 $this->start_controls_tabs('separators');
961
962 $this->start_controls_tab('separators_horizontal', ['label' => __('Horizontal', 'master-addons' )]);
963
964 $this->add_control(
965 'separators_horizontal_style',
966 [
967 'label' => __('Style', 'master-addons' ),
968 'type' => Controls_Manager::SELECT,
969 'default' => '',
970 'options' => [
971 '' => __('None', 'master-addons' ),
972 'solid' => _x('Solid', 'Border Control', 'master-addons' ),
973 'double' => _x('Double', 'Border Control', 'master-addons' ),
974 'dotted' => _x('Dotted', 'Border Control', 'master-addons' ),
975 'dashed' => _x('Dashed', 'Border Control', 'master-addons' ),
976 'groove' => _x('Groove', 'Border Control', 'master-addons' ),
977 ],
978 'selectors' => [
979 '{{WRAPPER}} tr:not(:last-child) td.ee-calendar__cell' => 'border-bottom-style: {{VALUE}};',
980 ],
981 ]
982 );
983
984 $this->add_control(
985 'separators_horizontal_width',
986 [
987 'label' => __('Width', 'master-addons' ),
988 'type' => Controls_Manager::SLIDER,
989 'default' => [
990 'size' => 1,
991 ],
992 'range' => [
993 'px' => [
994 'min' => 0,
995 'max' => 5,
996 'step' => 1,
997 ],
998 ],
999 'condition' => [
1000 'separators_horizontal_style!' => '',
1001 ],
1002 'selectors' => [
1003 '{{WRAPPER}} tr:not(:last-child) td.ee-calendar__cell' => 'border-bottom-width: {{SIZE}}px;',
1004 ],
1005 ]
1006 );
1007
1008 $this->add_control(
1009 'separators_horizontal_color',
1010 [
1011 'label' => __('Color', 'master-addons' ),
1012 'type' => Controls_Manager::COLOR,
1013 'default' => '',
1014 'condition' => [
1015 'separators_horizontal_style!' => '',
1016 ],
1017 'selectors' => [
1018 '{{WRAPPER}} tr:not(:last-child) td.ee-calendar__cell' => 'border-bottom-color: {{VALUE}};',
1019 ],
1020 ]
1021 );
1022
1023 $this->end_controls_tab();
1024
1025 $this->start_controls_tab('separators_vertical', ['label' => __('Vertical', 'master-addons' )]);
1026
1027 $this->add_control(
1028 'separators_vertical_style',
1029 [
1030 'label' => __('Style', 'master-addons' ),
1031 'type' => Controls_Manager::SELECT,
1032 'default' => '',
1033 'options' => [
1034 '' => __('None', 'master-addons' ),
1035 'solid' => _x('Solid', 'Border Control', 'master-addons' ),
1036 'double' => _x('Double', 'Border Control', 'master-addons' ),
1037 'dotted' => _x('Dotted', 'Border Control', 'master-addons' ),
1038 'dashed' => _x('Dashed', 'Border Control', 'master-addons' ),
1039 'groove' => _x('Groove', 'Border Control', 'master-addons' ),
1040 ],
1041 'selectors' => [
1042 '{{WRAPPER}} td:not(:first-child).ee-calendar__cell' => 'border-left-style: {{VALUE}};',
1043 ],
1044 ]
1045 );
1046
1047 $this->add_control(
1048 'separators_vertical_width',
1049 [
1050 'label' => __('Width', 'master-addons' ),
1051 'type' => Controls_Manager::SLIDER,
1052 'default' => [
1053 'size' => 1,
1054 ],
1055 'range' => [
1056 'px' => [
1057 'min' => 0,
1058 'max' => 5,
1059 'step' => 1,
1060 ],
1061 ],
1062 'condition' => [
1063 'separators_vertical_style!' => '',
1064 ],
1065 'selectors' => [
1066 '{{WRAPPER}} td:not(:first-child).ee-calendar__cell' => 'border-left-width: {{SIZE}}px;',
1067 ],
1068 ]
1069 );
1070
1071 $this->add_control(
1072 'separators_vertical_color',
1073 [
1074 'label' => __('Color', 'master-addons' ),
1075 'type' => Controls_Manager::COLOR,
1076 'default' => '',
1077 'condition' => [
1078 'separators_vertical_style!' => '',
1079 ],
1080 'selectors' => [
1081 '{{WRAPPER}} td:not(:first-child).ee-calendar__cell' => 'border-left-color: {{VALUE}};',
1082 ],
1083 ]
1084 );
1085
1086 $this->end_controls_tab();
1087
1088 $this->end_controls_tabs();
1089
1090 $this->end_controls_section();
1091
1092 $this->start_controls_section(
1093 'section_style_navigation',
1094 [
1095 'label' => __('Navigation', 'master-addons' ),
1096 'tab' => Controls_Manager::TAB_STYLE,
1097 ]
1098 );
1099
1100 $this->add_responsive_control(
1101 'navigation_padding',
1102 [
1103 'label' => __('Padding', 'master-addons' ),
1104 'type' => Controls_Manager::DIMENSIONS,
1105 'size_units' => ['px', 'em', '%'],
1106 'selectors' => [
1107 '{{WRAPPER}} .ee-calendar__controls' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1108 ],
1109 ]
1110 );
1111
1112 $this->add_responsive_control(
1113 'navigation_color',
1114 [
1115 'label' => __('Color', 'master-addons' ),
1116 'type' => Controls_Manager::COLOR,
1117 'default' => '',
1118 'selectors' => [
1119 '{{WRAPPER}} .ee-calendar__controls' => 'color: {{VALUE}};',
1120 ],
1121 ]
1122 );
1123
1124 $this->add_responsive_control(
1125 'navigation_background_color',
1126 [
1127 'label' => __('Background Color', 'master-addons' ),
1128 'type' => Controls_Manager::COLOR,
1129 'default' => '',
1130 'selectors' => [
1131 '{{WRAPPER}} .ee-calendar__controls' => 'background-color: {{VALUE}};',
1132 ],
1133 ]
1134 );
1135
1136 $this->add_responsive_control(
1137 'navigation_month_spacing',
1138 [
1139 'label' => __('Month Spacing', 'master-addons' ),
1140 'type' => Controls_Manager::SLIDER,
1141 'default' => [
1142 'size' => 12,
1143 ],
1144 'range' => [
1145 'px' => [
1146 'min' => 0,
1147 'max' => 100,
1148 'step' => 1,
1149 ],
1150 ],
1151 'selectors' => [
1152 '{{WRAPPER}}.ee-calendar-arrows-position--left .ee-calendar__controls__month' => 'margin-left: {{SIZE}}px;',
1153 '{{WRAPPER}}.ee-calendar-arrows-position--sides .ee-calendar__controls__month' => 'margin-left: {{SIZE}}px; margin-right: {{SIZE}}px;',
1154 '{{WRAPPER}}.ee-calendar-arrows-position--right .ee-calendar__controls__month' => 'margin-right: {{SIZE}}px;',
1155 ],
1156 ]
1157 );
1158
1159 $this->add_responsive_control(
1160 'navigation_text_align',
1161 [
1162 'label' => __('Align Text', 'master-addons' ),
1163 'type' => Controls_Manager::CHOOSE,
1164 'default' => '',
1165 'options' => [
1166 'left' => [
1167 'title' => __('Left', 'master-addons' ),
1168 'icon' => 'fa fa-align-left',
1169 ],
1170 'center' => [
1171 'title' => __('Center', 'master-addons' ),
1172 'icon' => 'fa fa-align-center',
1173 ],
1174 'right' => [
1175 'title' => __('Right', 'master-addons' ),
1176 'icon' => 'fa fa-align-right',
1177 ],
1178 ],
1179 'selectors' => [
1180 '{{WRAPPER}} .ee-calendar__controls__month' => 'text-align: {{VALUE}};',
1181 ],
1182 ]
1183 );
1184
1185 $this->add_group_control(
1186 Group_Control_Typography::get_type(),
1187 [
1188 'name' => 'navigation_typography',
1189 'selector' => '{{WRAPPER}} .ee-calendar__controls__month',
1190 'global' => [
1191 'default' => Global_Typography::TYPOGRAPHY_TEXT,
1192 ],
1193 ]
1194 );
1195
1196 $this->add_control(
1197 'navigation_buttons_heading',
1198 [
1199 'label' => __('Buttons', 'master-addons' ),
1200 'type' => \Elementor\Controls_Manager::HEADING,
1201 'separator' => 'before',
1202 ]
1203 );
1204
1205 $this->add_control(
1206 'arrows_position',
1207 [
1208 'label' => __('Position', 'master-addons' ),
1209 'type' => Controls_Manager::SELECT,
1210 'default' => 'sides',
1211 'options' => [
1212 'sides' => __('Sides', 'master-addons' ),
1213 'left' => __('Left', 'master-addons' ),
1214 'right' => __('Right', 'master-addons' ),
1215 ],
1216 'prefix_class' => 'jltma-calendar-arrows-position--',
1217 ]
1218 );
1219
1220 $this->add_responsive_control(
1221 'navigation_buttons_spacing',
1222 [
1223 'label' => __('Spacing', 'master-addons' ),
1224 'type' => Controls_Manager::SLIDER,
1225 'default' => [
1226 'size' => 12,
1227 ],
1228 'range' => [
1229 'px' => [
1230 'min' => 0,
1231 'max' => 100,
1232 'step' => 1,
1233 ],
1234 ],
1235 'condition' => [
1236 'arrows_position!' => 'sides',
1237 ],
1238 'selectors' => [
1239 '{{WRAPPER}} .ee-calendar__button--previous' => 'margin-right: {{SIZE}}px;',
1240 ],
1241 ]
1242 );
1243
1244 $this->add_responsive_control(
1245 'buttons_size',
1246 [
1247 'label' => __('Size', 'master-addons' ),
1248 'type' => Controls_Manager::SLIDER,
1249 'range' => [
1250 'px' => [
1251 'min' => 6,
1252 'max' => 48,
1253 'step' => 1,
1254 ],
1255 ],
1256 'selectors' => [
1257 '{{WRAPPER}} .ee-calendar__controls__button' => 'font-size: {{SIZE}}px;',
1258 ],
1259 ]
1260 );
1261
1262 $this->add_responsive_control(
1263 'buttons_padding',
1264 [
1265 'label' => __('Padding', 'master-addons' ),
1266 'type' => Controls_Manager::SLIDER,
1267 'range' => [
1268 'px' => [
1269 'min' => 0,
1270 'max' => 3,
1271 'step' => 0.1,
1272 ],
1273 ],
1274 'selectors' => [
1275 '{{WRAPPER}} .ee-calendar__controls__button' => 'padding: {{SIZE}}em;',
1276 ],
1277 ]
1278 );
1279
1280 $this->add_control(
1281 'buttons_border_radius',
1282 [
1283 'label' => __('Border Radius', 'master-addons' ),
1284 'type' => Controls_Manager::SLIDER,
1285 'range' => [
1286 'px' => [
1287 'min' => 0,
1288 'max' => 100,
1289 'step' => 1,
1290 ],
1291 ],
1292 'selectors' => [
1293 '{{WRAPPER}} .ee-calendar__controls__button' => 'border-radius: {{SIZE}}%;',
1294 ],
1295 ]
1296 );
1297
1298 $this->add_group_control(
1299 JLTMA_Transition::get_type(),
1300 [
1301 'name' => 'buttons',
1302 'selector' => '{{WRAPPER}} .ee-calendar__controls__button',
1303 'separator' => '',
1304 ]
1305 );
1306
1307 $this->start_controls_tabs('buttons');
1308
1309 $this->start_controls_tab('buttons_default', ['label' => __('Default', 'master-addons' )]);
1310
1311 $this->add_control(
1312 'button_color',
1313 [
1314 'label' => __('Color', 'master-addons' ),
1315 'type' => Controls_Manager::COLOR,
1316 'default' => '',
1317 'selectors' => [
1318 '{{WRAPPER}} .ee-calendar__controls__button' => 'color: {{VALUE}};',
1319 ],
1320 ]
1321 );
1322
1323 $this->add_control(
1324 'button_background_color',
1325 [
1326 'label' => __('Background Color', 'master-addons' ),
1327 'type' => Controls_Manager::COLOR,
1328 'global' => [
1329 'default' => Global_Colors::COLOR_PRIMARY,
1330 ],
1331 'default' => '',
1332 'selectors' => [
1333 '{{WRAPPER}} .ee-calendar__controls__button' => 'background-color: {{VALUE}};',
1334 ],
1335 ]
1336 );
1337
1338 $this->end_controls_tab();
1339
1340 $this->start_controls_tab('buttons_hover', ['label' => __('Hover', 'master-addons' )]);
1341
1342 $this->add_control(
1343 'button_color_hover',
1344 [
1345 'label' => __('Color', 'master-addons' ),
1346 'type' => Controls_Manager::COLOR,
1347 'default' => '',
1348 'selectors' => [
1349 '{{WRAPPER}} .ee-calendar__controls__button:hover' => 'color: {{VALUE}};',
1350 ],
1351 ]
1352 );
1353
1354 $this->add_control(
1355 'button_background_color_hover',
1356 [
1357 'label' => __('Background Color', 'master-addons' ),
1358 'type' => Controls_Manager::COLOR,
1359 'default' => '',
1360 'selectors' => [
1361 '{{WRAPPER}} .ee-calendar__controls__button:hover' => 'background-color: {{VALUE}};',
1362 ],
1363 ]
1364 );
1365
1366 $this->end_controls_tab();
1367
1368 $this->end_controls_tabs();
1369
1370 $this->add_control(
1371 'navigation_separator_heading',
1372 [
1373 'label' => __('Separator', 'master-addons' ),
1374 'type' => \Elementor\Controls_Manager::HEADING,
1375 'separator' => 'before',
1376 ]
1377 );
1378
1379 $this->add_control(
1380 'navigation_separator_style',
1381 [
1382 'label' => __('Style', 'master-addons' ),
1383 'type' => Controls_Manager::SELECT,
1384 'default' => '',
1385 'options' => [
1386 '' => __('None', 'master-addons' ),
1387 'solid' => _x('Solid', 'Border Control', 'master-addons' ),
1388 'double' => _x('Double', 'Border Control', 'master-addons' ),
1389 'dotted' => _x('Dotted', 'Border Control', 'master-addons' ),
1390 'dashed' => _x('Dashed', 'Border Control', 'master-addons' ),
1391 'groove' => _x('Groove', 'Border Control', 'master-addons' ),
1392 ],
1393 'selectors' => [
1394 '{{WRAPPER}} .ee-calendar__controls' => 'border-bottom-style: {{VALUE}};',
1395 ],
1396 ]
1397 );
1398
1399 $this->add_control(
1400 'navigation_separator_width',
1401 [
1402 'label' => __('Width', 'master-addons' ),
1403 'type' => Controls_Manager::SLIDER,
1404 'default' => [
1405 'size' => 1,
1406 ],
1407 'range' => [
1408 'px' => [
1409 'min' => 0,
1410 'max' => 5,
1411 'step' => 1,
1412 ],
1413 ],
1414 'condition' => [
1415 'navigation_separator_style!' => '',
1416 ],
1417 'selectors' => [
1418 '{{WRAPPER}} .ee-calendar__controls' => 'border-bottom-width: {{SIZE}}px;',
1419 ],
1420 ]
1421 );
1422
1423 $this->add_control(
1424 'navigation_separator_color',
1425 [
1426 'label' => __('Color', 'master-addons' ),
1427 'type' => Controls_Manager::COLOR,
1428 'default' => '',
1429 'condition' => [
1430 'navigation_separator_style!' => '',
1431 ],
1432 'selectors' => [
1433 '{{WRAPPER}} .ee-calendar__controls' => 'border-bottom-color: {{VALUE}};',
1434 ],
1435 ]
1436 );
1437
1438 $this->end_controls_section();
1439
1440 $this->start_controls_section(
1441 'section_style_header',
1442 [
1443 'label' => __('Header', 'master-addons' ),
1444 'tab' => Controls_Manager::TAB_STYLE,
1445 ]
1446 );
1447
1448 $this->add_control(
1449 'header_color',
1450 [
1451 'label' => __('Color', 'master-addons' ),
1452 'type' => Controls_Manager::COLOR,
1453 'default' => '',
1454 'selectors' => [
1455 '{{WRAPPER}} .ee-calendar__table__head' => 'color: {{VALUE}};',
1456 ],
1457 ]
1458 );
1459
1460 $this->add_control(
1461 'header_background_color',
1462 [
1463 'label' => __('Background Color', 'master-addons' ),
1464 'type' => Controls_Manager::COLOR,
1465 'default' => '',
1466 'selectors' => [
1467 '{{WRAPPER}} .ee-calendar__table__head' => 'background-color: {{VALUE}};',
1468 ],
1469 ]
1470 );
1471
1472 $this->add_responsive_control(
1473 'header_text_align',
1474 [
1475 'label' => __('Align Text', 'master-addons' ),
1476 'type' => Controls_Manager::CHOOSE,
1477 'default' => '',
1478 'options' => [
1479 'left' => [
1480 'title' => __('Left', 'master-addons' ),
1481 'icon' => 'fa fa-align-left',
1482 ],
1483 'center' => [
1484 'title' => __('Center', 'master-addons' ),
1485 'icon' => 'fa fa-align-center',
1486 ],
1487 'right' => [
1488 'title' => __('Right', 'master-addons' ),
1489 'icon' => 'fa fa-align-right',
1490 ],
1491 ],
1492 'selectors' => [
1493 '{{WRAPPER}} .ee-calendar__table__head .ee-calendar__cell__content' => 'text-align: {{VALUE}};',
1494 ],
1495 ]
1496 );
1497
1498 $this->add_group_control(
1499 Group_Control_Typography::get_type(),
1500 [
1501 'name' => 'header_days',
1502 'selector' => '{{WRAPPER}} .ee-calendar__table__head .ee-calendar__cell__content',
1503 'global' => [
1504 'default' => Global_Typography::TYPOGRAPHY_TEXT,
1505 ],
1506 ]
1507 );
1508
1509 $this->add_control(
1510 'header_separator_heading',
1511 [
1512 'label' => __('Separator', 'master-addons' ),
1513 'type' => \Elementor\Controls_Manager::HEADING,
1514 'separator' => 'before',
1515 ]
1516 );
1517
1518 $this->add_control(
1519 'header_separator_style',
1520 [
1521 'label' => __('Style', 'master-addons' ),
1522 'type' => Controls_Manager::SELECT,
1523 'default' => '',
1524 'options' => [
1525 '' => __('None', 'master-addons' ),
1526 'solid' => _x('Solid', 'Border Control', 'master-addons' ),
1527 'double' => _x('Double', 'Border Control', 'master-addons' ),
1528 'dotted' => _x('Dotted', 'Border Control', 'master-addons' ),
1529 'dashed' => _x('Dashed', 'Border Control', 'master-addons' ),
1530 'groove' => _x('Groove', 'Border Control', 'master-addons' ),
1531 ],
1532 'selectors' => [
1533 '{{WRAPPER}} .ee-calendar__table__head' => 'border-bottom-style: {{VALUE}};',
1534 ],
1535 ]
1536 );
1537
1538 $this->add_control(
1539 'header_separator_width',
1540 [
1541 'label' => __('Width', 'master-addons' ),
1542 'type' => Controls_Manager::SLIDER,
1543 'default' => [
1544 'size' => 1,
1545 ],
1546 'range' => [
1547 'px' => [
1548 'min' => 0,
1549 'max' => 5,
1550 'step' => 1,
1551 ],
1552 ],
1553 'condition' => [
1554 'header_separator_style!' => '',
1555 ],
1556 'selectors' => [
1557 '{{WRAPPER}} .ee-calendar__table__head' => 'border-bottom-width: {{SIZE}}px;',
1558 ],
1559 ]
1560 );
1561
1562 $this->add_control(
1563 'header_separator_color',
1564 [
1565 'label' => __('Color', 'master-addons' ),
1566 'type' => Controls_Manager::COLOR,
1567 'default' => '',
1568 'condition' => [
1569 'header_separator_style!' => '',
1570 ],
1571 'selectors' => [
1572 '{{WRAPPER}} .ee-calendar__table__head' => 'border-bottom-color: {{VALUE}};',
1573 ],
1574 ]
1575 );
1576
1577 $this->end_controls_section();
1578
1579 $this->start_controls_section(
1580 'section_style_days',
1581 [
1582 'label' => __('Days', 'master-addons' ),
1583 'tab' => Controls_Manager::TAB_STYLE,
1584 ]
1585 );
1586
1587 $this->add_responsive_control(
1588 'days_padding',
1589 [
1590 'label' => __('Padding', 'master-addons' ),
1591 'type' => Controls_Manager::SLIDER,
1592 'default' => [
1593 'size' => 12,
1594 ],
1595 'range' => [
1596 'px' => [
1597 'min' => 0,
1598 'max' => 100,
1599 'step' => 1,
1600 ],
1601 ],
1602 'selectors' => [
1603 '{{WRAPPER}} .ee-calendar__month' => 'padding: {{SIZE}}px;',
1604 ],
1605 ]
1606 );
1607
1608 $this->add_control(
1609 'days_border_radius',
1610 [
1611 'label' => __('Border Radius', 'master-addons' ),
1612 'type' => Controls_Manager::SLIDER,
1613 'range' => [
1614 'px' => [
1615 'min' => 0,
1616 'max' => 1000,
1617 'step' => 1,
1618 ],
1619 ],
1620 'selectors' => [
1621 '{{WRAPPER}} .ee-calendar__day__wrapper' => 'border-radius: {{SIZE}}px;',
1622 '{{WRAPPER}} .ee-calendar__day__header' => 'border-radius: {{SIZE}}px {{SIZE}}px 0 0;',
1623 ],
1624 ]
1625 );
1626
1627 $this->add_responsive_control(
1628 'days_text_align',
1629 [
1630 'label' => __('Align Text', 'master-addons' ),
1631 'type' => Controls_Manager::CHOOSE,
1632 'default' => '',
1633 'options' => [
1634 'left' => [
1635 'title' => __('Left', 'master-addons' ),
1636 'icon' => 'fa fa-align-left',
1637 ],
1638 'center' => [
1639 'title' => __('Center', 'master-addons' ),
1640 'icon' => 'fa fa-align-center',
1641 ],
1642 'right' => [
1643 'title' => __('Right', 'master-addons' ),
1644 'icon' => 'fa fa-align-right',
1645 ],
1646 ],
1647 'condition' => [
1648 'skin' => 'default',
1649 ],
1650 'selectors' => [
1651 '{{WRAPPER}} .ee-calendar__day__content' => 'text-align: {{VALUE}};',
1652 ],
1653 ]
1654 );
1655
1656 $this->add_control(
1657 'days_all_heading',
1658 [
1659 'label' => __('All Days', 'master-addons' ),
1660 'type' => \Elementor\Controls_Manager::HEADING,
1661 'separator' => 'before',
1662 ]
1663 );
1664
1665 $this->add_responsive_control(
1666 'days_all_padding_horizontal',
1667 [
1668 'label' => __('Horizontal Padding', 'master-addons' ),
1669 'type' => Controls_Manager::SLIDER,
1670 'range' => [
1671 'px' => [
1672 'min' => 0,
1673 'max' => 50,
1674 'step' => 1,
1675 ],
1676 ],
1677 'condition' => [
1678 'skin' => 'default',
1679 ],
1680 'selectors' => [
1681 '{{WRAPPER}} .ee-calendar__day__header,
1682 {{WRAPPER}} .ee-calendar__day__event__name,
1683 {{WRAPPER}} .ee-calendar__day__event__name:before' => 'padding-left: {{SIZE}}px; padding-right: {{SIZE}}px;',
1684 ],
1685 ]
1686 );
1687
1688 $this->add_responsive_control(
1689 'days_all_padding_vertical',
1690 [
1691 'label' => __('Vertical Padding', 'master-addons' ),
1692 'type' => Controls_Manager::SLIDER,
1693 'range' => [
1694 'px' => [
1695 'min' => 0,
1696 'max' => 50,
1697 'step' => 1,
1698 ],
1699 ],
1700 'condition' => [
1701 'skin' => 'default',
1702 ],
1703 'selectors' => [
1704 '{{WRAPPER}} .ee-calendar__day__header,
1705 {{WRAPPER}} .ee-calendar__day__event__name,
1706 {{WRAPPER}} .ee-calendar__day__event__name:before' => 'padding-top: {{SIZE}}px; padding-bottom: {{SIZE}}px;',
1707 ],
1708 ]
1709 );
1710
1711 $this->add_group_control(
1712 JLTMA_Transition::get_type(),
1713 [
1714 'name' => 'days',
1715 'selector' => '{{WRAPPER}} .ee-calendar__day__wrapper',
1716 'separator' => '',
1717 ]
1718 );
1719
1720 $this->start_controls_tabs('days');
1721
1722 $this->start_controls_tab('days_default', ['label' => __('Default', 'master-addons' )]);
1723
1724 $this->add_control(
1725 'day_all_color',
1726 [
1727 'label' => __('Color', 'master-addons' ),
1728 'type' => Controls_Manager::COLOR,
1729 'default' => '',
1730 'selectors' => [
1731 '{{WRAPPER}} .ee-calendar__day__wrapper' => 'color: {{VALUE}};',
1732 ],
1733 ]
1734 );
1735
1736 $this->add_control(
1737 'day_all_background_color',
1738 [
1739 'label' => __('Background Color', 'master-addons' ),
1740 'type' => Controls_Manager::COLOR,
1741 'default' => '',
1742 'selectors' => [
1743 '{{WRAPPER}} .ee-calendar__day__wrapper' => 'background-color: {{VALUE}};',
1744 ],
1745 ]
1746 );
1747
1748 $this->end_controls_tab();
1749
1750 $this->start_controls_tab('days_hover', ['label' => __('Hover', 'master-addons' )]);
1751
1752 $this->add_control(
1753 'day_all_color_hover',
1754 [
1755 'label' => __('Color', 'master-addons' ),
1756 'type' => Controls_Manager::COLOR,
1757 'default' => '',
1758 'selectors' => [
1759 '{{WRAPPER}} .ee-calendar__day__wrapper:hover' => 'color: {{VALUE}};',
1760 ],
1761 ]
1762 );
1763
1764 $this->add_control(
1765 'day_all_background_color_hover',
1766 [
1767 'label' => __('Background Color', 'master-addons' ),
1768 'type' => Controls_Manager::COLOR,
1769 'default' => '',
1770 'selectors' => [
1771 '{{WRAPPER}} .ee-calendar__day__wrapper:hover' => 'background-color: {{VALUE}};',
1772 ],
1773 ]
1774 );
1775
1776 $this->end_controls_tab();
1777
1778 $this->end_controls_tabs();
1779
1780 $this->add_control(
1781 'days_event_heading',
1782 [
1783 'label' => __('Event', 'master-addons' ),
1784 'type' => \Elementor\Controls_Manager::HEADING,
1785 'separator' => 'before',
1786 ]
1787 );
1788
1789 $this->start_controls_tabs('days_event');
1790
1791 $this->start_controls_tab('days_event_default', ['label' => __('Default', 'master-addons' )]);
1792
1793 $this->add_control(
1794 'day_event_color',
1795 [
1796 'label' => __('Color', 'master-addons' ),
1797 'type' => Controls_Manager::COLOR,
1798 'default' => '#ffffff',
1799 'selectors' => [
1800 '{{WRAPPER}} .ee-calendar__day--event .ee-calendar__day__wrapper,
1801 {{WRAPPER}} .ee-calendar__day--event .ee-calendar__day__event__name,
1802 {{WRAPPER}} .ee-calendar__day--event .ee-calendar__day__event__name:before' => 'color: {{VALUE}};',
1803 ],
1804 ]
1805 );
1806
1807 $this->add_control(
1808 'day_event_background_color',
1809 [
1810 'label' => __('Background Color', 'master-addons' ),
1811 'type' => Controls_Manager::COLOR,
1812 'global' => [
1813 'default' => Global_Colors::COLOR_PRIMARY,
1814 ],
1815 'selectors' => [
1816 '{{WRAPPER}} .ee-calendar__day--event .ee-calendar__day__wrapper,
1817 {{WRAPPER}} .ee-calendar__day--event .ee-calendar__day__event__name,
1818 {{WRAPPER}} .ee-calendar__day--event .ee-calendar__day__event__name:before' => 'background-color: {{VALUE}};',
1819 ],
1820 ]
1821 );
1822
1823 $this->add_group_control(
1824 Group_Control_Box_Shadow::get_type(),
1825 [
1826 'name' => 'day_event_box_shadow',
1827 'selector' => '{{WRAPPER}} .ee-calendar__day--event .ee-calendar__day__wrapper',
1828 ]
1829 );
1830
1831 $this->end_controls_tab();
1832
1833 $this->start_controls_tab('days_event_hover', ['label' => __('Hover', 'master-addons' )]);
1834
1835 $this->add_control(
1836 'day_event_color_hover',
1837 [
1838 'label' => __('Color', 'master-addons' ),
1839 'type' => Controls_Manager::COLOR,
1840 'default' => '',
1841 'selectors' => [
1842 '{{WRAPPER}} .ee-calendar__day--event .ee-calendar__day__wrapper:hover,
1843 {{WRAPPER}} .ee-calendar__day--event .ee-calendar__day__wrapper:hover .ee-calendar__day__event__name,
1844 {{WRAPPER}} .ee-calendar__day--event .ee-calendar__day__wrapper:hover .ee-calendar__day__event__name:before' => 'color: {{VALUE}};',
1845 ],
1846 ]
1847 );
1848
1849 $this->add_control(
1850 'day_event_background_color_hover',
1851 [
1852 'label' => __('Background Color', 'master-addons' ),
1853 'type' => Controls_Manager::COLOR,
1854 'default' => '',
1855 'selectors' => [
1856 '{{WRAPPER}} .ee-calendar__day--event .ee-calendar__day__wrapper:hover,
1857 {{WRAPPER}} .ee-calendar__day--event .ee-calendar__day__wrapper:hover .ee-calendar__day__event__name,
1858 {{WRAPPER}} .ee-calendar__day--event .ee-calendar__day__wrapper:hover .ee-calendar__day__event__name:before' => 'background-color: {{VALUE}};',
1859 ],
1860 ]
1861 );
1862
1863 $this->add_group_control(
1864 Group_Control_Box_Shadow::get_type(),
1865 [
1866 'name' => 'day_event_box_shadow_hover',
1867 'selector' => '{{WRAPPER}} .ee-calendar__day--event .ee-calendar__day__wrapper:hover',
1868 ]
1869 );
1870
1871 $this->end_controls_tab();
1872
1873 $this->end_controls_tabs();
1874
1875 $this->add_control(
1876 'days_today_heading',
1877 [
1878 'label' => __('Today', 'master-addons' ),
1879 'type' => \Elementor\Controls_Manager::HEADING,
1880 'separator' => 'before',
1881 ]
1882 );
1883
1884 $this->start_controls_tabs('days_today');
1885
1886 $this->start_controls_tab('days_today_default', ['label' => __('Default', 'master-addons' )]);
1887
1888 $this->add_control(
1889 'day_today_color',
1890 [
1891 'label' => __('Color', 'master-addons' ),
1892 'type' => Controls_Manager::COLOR,
1893 'default' => '#ffffff',
1894 'selectors' => [
1895 '{{WRAPPER}} .ee-calendar__day--today .ee-calendar__day__wrapper,
1896 {{WRAPPER}} .ee-calendar__day--today .ee-calendar__day__event__name,
1897 {{WRAPPER}} .ee-calendar__day--today .ee-calendar__day__event__name:before' => 'color: {{VALUE}};',
1898 ],
1899 ]
1900 );
1901
1902 $this->add_control(
1903 'day_today_background_color',
1904 [
1905 'label' => __('Background Color', 'master-addons' ),
1906 'type' => Controls_Manager::COLOR,
1907 'global' => [
1908 'default' => Global_Colors::COLOR_SECONDARY,
1909 ],
1910 'selectors' => [
1911 '{{WRAPPER}} .ee-calendar__day--today .ee-calendar__day__wrapper,
1912 {{WRAPPER}} .ee-calendar__day--today .ee-calendar__day__event__name,
1913 {{WRAPPER}} .ee-calendar__day--today .ee-calendar__day__event__name:before' => 'background-color: {{VALUE}};',
1914 ],
1915 ]
1916 );
1917
1918 $this->end_controls_tab();
1919
1920 $this->start_controls_tab('days_today_hover', ['label' => __('Hover', 'master-addons' )]);
1921
1922 $this->add_control(
1923 'day_today_color_hover',
1924 [
1925 'label' => __('Color', 'master-addons' ),
1926 'type' => Controls_Manager::COLOR,
1927 'default' => '',
1928 'selectors' => [
1929 '{{WRAPPER}} .ee-calendar__day--today .ee-calendar__day__wrapper:hover,
1930 {{WRAPPER}} .ee-calendar__day--today .ee-calendar__day__wrapper:hover .ee-calendar__day__event__name,
1931 {{WRAPPER}} .ee-calendar__day--today .ee-calendar__day__wrapper:hover .ee-calendar__day__event__name:before' => 'color: {{VALUE}};',
1932 ],
1933 ]
1934 );
1935
1936 $this->add_control(
1937 'day_today_background_color_hover',
1938 [
1939 'label' => __('Background Color', 'master-addons' ),
1940 'type' => Controls_Manager::COLOR,
1941 'default' => '',
1942 'selectors' => [
1943 '{{WRAPPER}} .ee-calendar__day--today .ee-calendar__day__wrapper:hover,
1944 {{WRAPPER}} .ee-calendar__day--today .ee-calendar__day__wrapper:hover .ee-calendar__day__event__name,
1945 {{WRAPPER}} .ee-calendar__day--today .ee-calendar__day__wrapper:hover .ee-calendar__day__event__name:before' => 'background-color: {{VALUE}};',
1946 ],
1947 ]
1948 );
1949
1950 $this->end_controls_tab();
1951
1952 $this->end_controls_tabs();
1953
1954 $this->add_control(
1955 'days_passed_heading',
1956 [
1957 'label' => __('Passed', 'master-addons' ),
1958 'type' => \Elementor\Controls_Manager::HEADING,
1959 'separator' => 'before',
1960 ]
1961 );
1962
1963 $this->start_controls_tabs('days_passed');
1964
1965 $this->start_controls_tab('days_passed_default', ['label' => __('Default', 'master-addons' )]);
1966
1967 $this->add_control(
1968 'day_passed_color',
1969 [
1970 'label' => __('Color', 'master-addons' ),
1971 'type' => Controls_Manager::COLOR,
1972 'selectors' => [
1973 '{{WRAPPER}} .ee-calendar__day--passed .ee-calendar__day__wrapper,
1974 {{WRAPPER}} .ee-calendar__day--passed .ee-calendar__day__event__name,
1975 {{WRAPPER}} .ee-calendar__day--passed .ee-calendar__day__event__name:before' => 'color: {{VALUE}};',
1976 ],
1977 ]
1978 );
1979
1980 $this->add_control(
1981 'day_passed_background_color',
1982 [
1983 'label' => __('Background Color', 'master-addons' ),
1984 'type' => Controls_Manager::COLOR,
1985 'selectors' => [
1986 '{{WRAPPER}} .ee-calendar__day--passed .ee-calendar__day__wrapper,
1987 {{WRAPPER}} .ee-calendar__day--passed .ee-calendar__day__event__name,
1988 {{WRAPPER}} .ee-calendar__day--passed .ee-calendar__day__event__name:before' => 'background-color: {{VALUE}};',
1989 ],
1990 ]
1991 );
1992
1993 $this->end_controls_tab();
1994
1995 $this->start_controls_tab('days_passed_hover', ['label' => __('Hover', 'master-addons' )]);
1996
1997 $this->add_control(
1998 'day_passed_color_hover',
1999 [
2000 'label' => __('Color', 'master-addons' ),
2001 'type' => Controls_Manager::COLOR,
2002 'default' => '',
2003 'selectors' => [
2004 '{{WRAPPER}} .ee-calendar__day--passed .ee-calendar__day__wrapper:hover,
2005 {{WRAPPER}} .ee-calendar__day--passed .ee-calendar__day__wrapper:hover .ee-calendar__day__event__name,
2006 {{WRAPPER}} .ee-calendar__day--passed .ee-calendar__day__wrapper:hover .ee-calendar__day__event__name:before' => 'color: {{VALUE}};',
2007 ],
2008 ]
2009 );
2010
2011 $this->add_control(
2012 'day_passed_background_color_hover',
2013 [
2014 'label' => __('Background Color', 'master-addons' ),
2015 'type' => Controls_Manager::COLOR,
2016 'default' => '',
2017 'selectors' => [
2018 '{{WRAPPER}} .ee-calendar__day--passed .ee-calendar__day__wrapper:hover,
2019 {{WRAPPER}} .ee-calendar__day--passed .ee-calendar__day__wrapper:hover .ee-calendar__day__event__name,
2020 {{WRAPPER}} .ee-calendar__day--passed .ee-calendar__day__wrapper:hover .ee-calendar__day__event__name:before' => 'background-color: {{VALUE}};',
2021 ],
2022 ]
2023 );
2024
2025 $this->end_controls_tab();
2026
2027 $this->end_controls_tabs();
2028
2029 $this->add_control(
2030 'days_passed_events_heading',
2031 [
2032 'label' => __('Passed Events', 'master-addons' ),
2033 'type' => \Elementor\Controls_Manager::HEADING,
2034 'separator' => 'before',
2035 ]
2036 );
2037
2038 $this->start_controls_tabs('days_passed_events');
2039
2040 $this->start_controls_tab('days_passed_events_default', ['label' => __('Default', 'master-addons' )]);
2041
2042 $this->add_control(
2043 'day_passed_events_color',
2044 [
2045 'label' => __('Color', 'master-addons' ),
2046 'type' => Controls_Manager::COLOR,
2047 'selectors' => [
2048 '{{WRAPPER}} .ee-calendar__day--passed.ee-calendar__day--event .ee-calendar__day__wrapper,
2049 {{WRAPPER}} .ee-calendar__day--passed.ee-calendar__day--event .ee-calendar__day__event__name,
2050 {{WRAPPER}} .ee-calendar__day--passed.ee-calendar__day--event .ee-calendar__day__event__name:before' => 'color: {{VALUE}};',
2051 ],
2052 ]
2053 );
2054
2055 $this->add_control(
2056 'day_passed_events_background_color',
2057 [
2058 'label' => __('Background Color', 'master-addons' ),
2059 'type' => Controls_Manager::COLOR,
2060 'selectors' => [
2061 '{{WRAPPER}} .ee-calendar__day--passed.ee-calendar__day--event .ee-calendar__day__wrapper,
2062 {{WRAPPER}} .ee-calendar__day--passed.ee-calendar__day--event .ee-calendar__day__event__name,
2063 {{WRAPPER}} .ee-calendar__day--passed.ee-calendar__day--event .ee-calendar__day__event__name:before' => 'background-color: {{VALUE}};',
2064 ],
2065 ]
2066 );
2067
2068 $this->end_controls_tab();
2069
2070 $this->start_controls_tab('days_passed_events_hover', ['label' => __('Hover', 'master-addons' )]);
2071
2072 $this->add_control(
2073 'day_passed_events_color_hover',
2074 [
2075 'label' => __('Color', 'master-addons' ),
2076 'type' => Controls_Manager::COLOR,
2077 'default' => '',
2078 'selectors' => [
2079 '{{WRAPPER}} .ee-calendar__day--passed.ee-calendar__day--event .ee-calendar__day__wrapper:hover,
2080 {{WRAPPER}} .ee-calendar__day--passed.ee-calendar__day--event .ee-calendar__day__wrapper:hover .ee-calendar__day__event__name,
2081 {{WRAPPER}} .ee-calendar__day--passed.ee-calendar__day--event .ee-calendar__day__wrapper:hover .ee-calendar__day__event__name:before' => 'color: {{VALUE}};',
2082 ],
2083 ]
2084 );
2085
2086 $this->add_control(
2087 'day_passed_events_background_color_hover',
2088 [
2089 'label' => __('Background Color', 'master-addons' ),
2090 'type' => Controls_Manager::COLOR,
2091 'default' => '',
2092 'selectors' => [
2093 '{{WRAPPER}} .ee-calendar__day--passed.ee-calendar__day--event .ee-calendar__day__wrapper:hover,
2094 {{WRAPPER}} .ee-calendar__day--passed.ee-calendar__day--event .ee-calendar__day__wrapper:hover .ee-calendar__day__event__name,
2095 {{WRAPPER}} .ee-calendar__day--passed.ee-calendar__day--event .ee-calendar__day__wrapper:hover .ee-calendar__day__event__name:before' => 'background-color: {{VALUE}};',
2096 ],
2097 ]
2098 );
2099
2100 $this->end_controls_tab();
2101
2102 $this->end_controls_tabs();
2103
2104 $this->add_control(
2105 'days_adjacent_heading',
2106 [
2107 'label' => __('Adjacent', 'master-addons' ),
2108 'type' => \Elementor\Controls_Manager::HEADING,
2109 'separator' => 'before',
2110 ]
2111 );
2112
2113 $this->add_control(
2114 'day_adjacent_opacity',
2115 [
2116 'label' => __('Opacity', 'master-addons' ),
2117 'type' => Controls_Manager::SLIDER,
2118 'range' => [
2119 'px' => [
2120 'min' => 0,
2121 'max' => 1,
2122 'step' => 0.1,
2123 ],
2124 ],
2125 'selectors' => [
2126 '{{WRAPPER}} .ee-calendar__day--adjacent .ee-calendar__day__wrapper' => 'opacity: {{SIZE}};',
2127 ],
2128 ]
2129 );
2130
2131 $this->end_controls_section();
2132
2133 $this->start_controls_section(
2134 'section_style_events',
2135 [
2136 'label' => __('Events', 'master-addons' ),
2137 'tab' => Controls_Manager::TAB_STYLE,
2138 'condition' => [
2139 'skin' => 'compact',
2140 ],
2141 ]
2142 );
2143
2144 $this->add_control(
2145 'events_header_heading',
2146 [
2147 'label' => __('Header', 'master-addons' ),
2148 'type' => \Elementor\Controls_Manager::HEADING,
2149 'condition' => [
2150 'skin' => 'compact',
2151 ],
2152 ]
2153 );
2154
2155 $this->add_responsive_control(
2156 'events_header_padding',
2157 [
2158 'label' => __('Padding', 'master-addons' ),
2159 'type' => Controls_Manager::DIMENSIONS,
2160 'size_units' => ['px', 'em', '%'],
2161 'selectors' => [
2162 '{{WRAPPER}} .ee-calendar__events__header' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2163 ],
2164 ]
2165 );
2166
2167 $this->add_control(
2168 'events_header_color',
2169 [
2170 'label' => __('Color', 'master-addons' ),
2171 'type' => Controls_Manager::COLOR,
2172 'default' => '',
2173 'selectors' => [
2174 '{{WRAPPER}} .ee-calendar__events__header' => 'color: {{VALUE}};',
2175 ],
2176 ]
2177 );
2178
2179 $this->add_control(
2180 'events_header_background_color',
2181 [
2182 'label' => __('Background Color', 'master-addons' ),
2183 'type' => Controls_Manager::COLOR,
2184 'default' => '',
2185 'selectors' => [
2186 '{{WRAPPER}} .ee-calendar__events__header' => 'background-color: {{VALUE}};',
2187 ],
2188 ]
2189 );
2190
2191 $this->add_responsive_control(
2192 'events_header_title_spacing',
2193 [
2194 'label' => __('Title Spacing', 'master-addons' ),
2195 'type' => Controls_Manager::SLIDER,
2196 'default' => [
2197 'size' => 12,
2198 ],
2199 'range' => [
2200 'px' => [
2201 'min' => 0,
2202 'max' => 100,
2203 'step' => 1,
2204 ],
2205 ],
2206 'condition' => [
2207 'skin' => 'compact',
2208 ],
2209 'selectors' => [
2210 '{{WRAPPER}} .ee-calendar__events__header__title' => 'margin-right: {{SIZE}}px;',
2211 ],
2212 ]
2213 );
2214
2215 $this->add_responsive_control(
2216 'events_header_text_align',
2217 [
2218 'label' => __('Align Text', 'master-addons' ),
2219 'type' => Controls_Manager::CHOOSE,
2220 'default' => 'left',
2221 'options' => [
2222 'left' => [
2223 'title' => __('Left', 'master-addons' ),
2224 'icon' => 'fa fa-align-left',
2225 ],
2226 'center' => [
2227 'title' => __('Center', 'master-addons' ),
2228 'icon' => 'fa fa-align-center',
2229 ],
2230 'right' => [
2231 'title' => __('Right', 'master-addons' ),
2232 'icon' => 'fa fa-align-right',
2233 ],
2234 ],
2235 'condition' => [
2236 'skin' => 'compact',
2237 ],
2238 'selectors' => [
2239 '{{WRAPPER}} .ee-calendar__table__head .ee-calendar__events__header__title' => 'text-align: {{VALUE}};',
2240 ],
2241 ]
2242 );
2243
2244 $this->add_group_control(
2245 Group_Control_Typography::get_type(),
2246 [
2247 'name' => 'events_header',
2248 'selector' => '{{WRAPPER}} .ee-calendar__events__header__title',
2249 'global' => [
2250 'default' => Global_Typography::TYPOGRAPHY_TEXT,
2251 ],
2252 ]
2253 );
2254
2255 $this->add_control(
2256 'events_separator_heading',
2257 [
2258 'label' => __('Separator', 'master-addons' ),
2259 'type' => \Elementor\Controls_Manager::HEADING,
2260 'separator' => 'before',
2261 'condition' => [
2262 'skin' => 'compact',
2263 ],
2264 ]
2265 );
2266
2267 $this->add_control(
2268 'events_separator_style',
2269 [
2270 'label' => __('Style', 'master-addons' ),
2271 'type' => Controls_Manager::SELECT,
2272 'default' => '',
2273 'options' => [
2274 '' => __('None', 'master-addons' ),
2275 'solid' => _x('Solid', 'Border Control', 'master-addons' ),
2276 'double' => _x('Double', 'Border Control', 'master-addons' ),
2277 'dotted' => _x('Dotted', 'Border Control', 'master-addons' ),
2278 'dashed' => _x('Dashed', 'Border Control', 'master-addons' ),
2279 'groove' => _x('Groove', 'Border Control', 'master-addons' ),
2280 ],
2281 'condition' => [
2282 'skin' => 'compact',
2283 ],
2284 'selectors' => [
2285 '{{WRAPPER}} .ee-calendar__events__event:not(:last-child)' => 'border-bottom-style: {{VALUE}};',
2286 ],
2287 ]
2288 );
2289
2290 $this->add_control(
2291 'events_separator_width',
2292 [
2293 'label' => __('Width', 'master-addons' ),
2294 'type' => Controls_Manager::SLIDER,
2295 'default' => [
2296 'size' => 1,
2297 ],
2298 'range' => [
2299 'px' => [
2300 'min' => 0,
2301 'max' => 5,
2302 'step' => 1,
2303 ],
2304 ],
2305 'condition' => [
2306 'skin' => 'compact',
2307 'events_separator_style!' => '',
2308 ],
2309 'selectors' => [
2310 '{{WRAPPER}} .ee-calendar__events__event:not(:last-child)' => 'border-bottom-width: {{SIZE}}px;',
2311 ],
2312 ]
2313 );
2314
2315 $this->add_control(
2316 'events_separator_color',
2317 [
2318 'label' => __('Color', 'master-addons' ),
2319 'type' => Controls_Manager::COLOR,
2320 'default' => '',
2321 'condition' => [
2322 'skin' => 'compact',
2323 'events_separator_style!' => '',
2324 ],
2325 'selectors' => [
2326 '{{WRAPPER}} .ee-calendar__events__event:not(:last-child)' => 'border-bottom-color: {{VALUE}};',
2327 ],
2328 ]
2329 );
2330
2331 $this->add_control(
2332 'events_list_heading',
2333 [
2334 'label' => __('List', 'master-addons' ),
2335 'type' => \Elementor\Controls_Manager::HEADING,
2336 'separator' => 'before',
2337 'condition' => [
2338 'skin' => 'compact',
2339 ],
2340 ]
2341 );
2342
2343 $this->add_responsive_control(
2344 'event_padding',
2345 [
2346 'label' => __('Padding', 'master-addons' ),
2347 'type' => Controls_Manager::DIMENSIONS,
2348 'size_units' => ['px', 'em', '%'],
2349 'selectors' => [
2350 '{{WRAPPER}} .ee-calendar__events__event' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2351 ],
2352 ]
2353 );
2354
2355 $this->start_controls_tabs('event_tabs');
2356
2357 $this->start_controls_tab('event_default', ['label' => __('Default', 'master-addons' )]);
2358
2359 $this->add_control(
2360 'event_color',
2361 [
2362 'label' => __('Color', 'master-addons' ),
2363 'type' => Controls_Manager::COLOR,
2364 'selectors' => [
2365 '{{WRAPPER}} .ee-calendar__events__event' => 'color: {{VALUE}};',
2366 ],
2367 'condition' => [
2368 'skin' => 'compact',
2369 ],
2370 ]
2371 );
2372
2373 $this->add_control(
2374 'event_background_color',
2375 [
2376 'label' => __('Background Color', 'master-addons' ),
2377 'type' => Controls_Manager::COLOR,
2378 'selectors' => [
2379 '{{WRAPPER}} .ee-calendar__events__event' => 'background-color: {{VALUE}};',
2380 ],
2381 'condition' => [
2382 'skin' => 'compact',
2383 ],
2384 ]
2385 );
2386
2387 $this->end_controls_tab();
2388
2389 $this->start_controls_tab('event_hover', ['label' => __('Hover', 'master-addons' )]);
2390
2391 $this->add_control(
2392 'event_color_hover',
2393 [
2394 'label' => __('Color', 'master-addons' ),
2395 'type' => Controls_Manager::COLOR,
2396 'default' => '',
2397 'selectors' => [
2398 '{{WRAPPER}} .ee-calendar__events__event:hover' => 'color: {{VALUE}};',
2399 ],
2400 'condition' => [
2401 'skin' => 'compact',
2402 ],
2403 ]
2404 );
2405
2406 $this->add_control(
2407 'event_background_color_hover',
2408 [
2409 'label' => __('Background Color', 'master-addons' ),
2410 'type' => Controls_Manager::COLOR,
2411 'default' => '',
2412 'selectors' => [
2413 '{{WRAPPER}} .ee-calendar__events__event:hover' => 'background-color: {{VALUE}};',
2414 ],
2415 'condition' => [
2416 'skin' => 'compact',
2417 ],
2418 ]
2419 );
2420
2421 $this->end_controls_tab();
2422
2423 $this->end_controls_tabs();
2424
2425 $this->end_controls_section();
2426
2427 $this->start_controls_section(
2428 'section_style_no_events',
2429 [
2430 'tab' => Controls_Manager::TAB_STYLE,
2431 'label' => __('No Events', 'master-addons' ),
2432 'condition' => [
2433 'no_events' => 'message',
2434 ],
2435 ]
2436 );
2437
2438 $this->add_control(
2439 'no_events_message_color',
2440 [
2441 'label' => __('Color', 'master-addons' ),
2442 'type' => Controls_Manager::COLOR,
2443 'global' => [
2444 'default' => Global_Colors::COLOR_TEXT,
2445 ],
2446 'selectors' => [
2447 '{{WRAPPER}} .ee-calendar__no-events' => 'color: {{VALUE}};',
2448 ],
2449 ]
2450 );
2451
2452 $this->add_group_control(
2453 Group_Control_Typography::get_type(),
2454 [
2455 'name' => 'no_events_message_typography',
2456 'global' => [
2457 'default' => Global_Typography::TYPOGRAPHY_TEXT,
2458 ],
2459 'selector' => '{{WRAPPER}} .ee-calendar__no-events',
2460 ]
2461 );
2462
2463 $this->add_responsive_control(
2464 'no_events_message_padding',
2465 [
2466 'label' => __('Padding', 'master-addons' ),
2467 'type' => Controls_Manager::DIMENSIONS,
2468 'size_units' => ['px', 'em', '%'],
2469 'selectors' => [
2470 '{{WRAPPER}} .ee-calendar__no-events' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2471 ],
2472 ]
2473 );
2474
2475 $this->end_controls_section();
2476 }
2477
2478 /**
2479 * Render
2480 *
2481 * Render widget contents on frontend
2482 *
2483 * @since 2.0.0
2484 * @return void
2485 */
2486 protected function render()
2487 {
2488 $settings = $this->get_settings_for_display();
2489
2490 switch ($settings['source']) {
2491 case 'manual':
2492 $this->setup_manual();
2493 break;
2494
2495 case 'posts':
2496 $this->get_posts_data();
2497 break;
2498
2499 default:
2500 $this->setup_manual();
2501 }
2502
2503 $this->render_data();
2504 }
2505
2506 /**
2507 * Get Post Data
2508 *
2509 * @since 2.0.0
2510 * @return void
2511 */
2512 protected function get_posts_data()
2513 {
2514 $settings = $this->get_settings_for_display();
2515 $events = [];
2516 $args = [
2517 'post_type' => $settings['post_type'],
2518 'post_status' => 'publish',
2519 'posts_per_page' => -1,
2520 'numberposts' => -1,
2521 'suppress_filters' => false,
2522 'order' => $settings['event_order'],
2523 ];
2524
2525 if ('post_date' !== $settings['post_dates_field_type']) {
2526 $data_type = 'field';
2527 } else {
2528 $data_type = 'post';
2529 }
2530
2531 $args = call_user_func_array([$this, 'parse_' . $data_type . '_query_args'], [$args, $settings['post_dates_field_type']]);
2532
2533 /**
2534 * Posts Args Filter
2535 *
2536 * Filters the query args when fetching posts
2537 *
2538 * @since 2.2.0
2539 * @param array $args The query args
2540 * @param WP_Post $post The widget settings
2541 */
2542 $args = apply_filters('master_addons/widgets/calendar/events/query/args', $args, $settings);
2543
2544 $posts = get_posts($args);
2545
2546 foreach ($posts as $post) {
2547
2548 $field_data = call_user_func_array([$this, 'get_' . $data_type . '_dates_args'], [$post]);
2549
2550 if (!$field_data || !$field_data['start_date']) {
2551 continue;
2552 }
2553
2554 $event_post_id = $post->ID;
2555 $event_title = $post->post_title;
2556 $event_link = '' !== $settings['link'] ? get_permalink($post->ID) : '';
2557 $event_target = '' !== $settings['link_is_external'] ? '_blank' : '';
2558 $event_rel = '' !== $settings['link_no_follow'] ? 'nofollow' : '';
2559 $event_start_date = $field_data['start_date'];
2560 $event_end_date = $field_data['end_date'];
2561 $event_archive = $field_data['archive'];
2562
2563 $event = [
2564 'post_id' => $event_post_id,
2565 'title' => $event_title,
2566 'start' => $event_start_date,
2567 'end' => $event_end_date,
2568 'link' => $event_link,
2569 'target' => $event_target,
2570 'rel' => $event_rel,
2571 'archive' => $event_archive,
2572 ];
2573
2574 /**
2575 * Posts Events Filter
2576 *
2577 * Provides access to events setup from posts
2578 *
2579 * @since 2.2.0
2580 * @param array $event The event settings
2581 * @param WP_Post $post The event post object
2582 */
2583 $events[] = apply_filters('master_addons/widgets/calendar/events/event', $event, $post);
2584 }
2585
2586 /**
2587 * Posts Events Filter
2588 *
2589 * Provides access to events setup from posts
2590 *
2591 * @since 2.2.0
2592 * @param array $events The array of events
2593 * @param array $settings The widget settings
2594 */
2595 $this->_events = apply_filters('master_addons/widgets/calendar/events', $events, $settings);
2596 }
2597
2598 /**
2599 * Parse query args for posts
2600 *
2601 * @since 2.2.42
2602 * @return array
2603 */
2604 protected function parse_post_query_args($args, $type)
2605 {
2606 return $args;
2607 }
2608
2609 /**
2610 * Parse query args for custom fields
2611 *
2612 * @since 2.2.42
2613 * @return array
2614 */
2615 protected function parse_field_query_args($args, $type)
2616 {
2617
2618 if ('acf' !== $type) {
2619 return $args;
2620 }
2621
2622 $settings = $this->get_settings();
2623
2624 $start_date_key = $settings['post_start_date_' . esc_attr($settings['post_dates_field_type']) . '_' . esc_attr($settings['post_type'])];
2625
2626 if ($start_date_key) {
2627 $field_object = get_field_object($start_date_key);
2628
2629 $args['orderby'] = 'meta_value';
2630 $args['meta_key'] = $field_object['name'];
2631 }
2632
2633 return $args;
2634 }
2635
2636 /**
2637 * Get Post Dates Args
2638 *
2639 * @since 2.2.42
2640 * @return array
2641 */
2642 protected function get_post_dates_args($post)
2643 {
2644 $data = [
2645 'start_date' => false,
2646 'end_date' => false,
2647 'archive' => false,
2648 ];
2649
2650 if ($post) {
2651 $data['start_date'] = $end_date = $post->post_date;
2652 $data['archive'] = get_day_link(get_the_date('Y', $post), get_the_date('m', $post), get_the_date('d', $post));
2653 }
2654
2655 return $data;
2656 }
2657
2658 /**
2659 * Get Fields Dates Args
2660 *
2661 * @since 2.2.42
2662 * @return array|bool
2663 */
2664 protected function get_field_dates_args($post)
2665 {
2666 $settings = $this->get_settings();
2667 $customfields = new CustomFieldsModule();
2668 $data = [
2669 'start_date' => false,
2670 'end_date' => false,
2671 'archive' => false,
2672 ];
2673
2674 if ($post) {
2675 $field = $customfields->get_component($settings['post_dates_field_type']);
2676
2677 if (!$field) {
2678 return false;
2679 }
2680
2681 $start_date_key = $settings['post_start_date_' . esc_attr($settings['post_dates_field_type']) . '_' . esc_attr($settings['post_type'])];
2682 $end_date_key = $settings['post_end_date_' . esc_attr($settings['post_dates_field_type']) . '_' . esc_attr($settings['post_type'])];
2683
2684 $data['start_date'] = $field->get_field_value($post->ID, $start_date_key);
2685 $data['end_date'] = $field->get_field_value($post->ID, $end_date_key);
2686 $data['archive'] = '';
2687 }
2688
2689 return $data;
2690 }
2691
2692 /**
2693 * Setup Manual
2694 *
2695 * Sets up events data
2696 *
2697 * @since 2.0.0
2698 * @return void
2699 */
2700 protected function setup_manual()
2701 {
2702 $settings = $this->get_settings_for_display();
2703 $events = [];
2704
2705 if (empty($settings['events']))
2706 return;
2707
2708 foreach ($settings['events'] as $index => $event) {
2709 $events[] = [
2710 'title' => $event['title'],
2711 'start' => $event['start'],
2712 'end' => $event['end'],
2713 'link' => ('' !== $event['link']['url']) ? $event['link']['url'] : '',
2714 'target' => $event['link']['is_external'] ? '_blank' : '_self',
2715 'rel' => !empty($event['link']['nofollow']) ? 'nofollow' : '',
2716 'archive' => false,
2717 ];
2718 }
2719
2720 /**
2721 * Manual Events Filter
2722 *
2723 * Provides access to manually set events date
2724 *
2725 * @since 2.2.0
2726 * @param string $events The array of events
2727 * @param string $settings The widget settings
2728 */
2729 $this->_events = apply_filters('master_addons/widgets/calendar/events/manual', $events, $settings);
2730 }
2731
2732 /**
2733 * Render data
2734 *
2735 * @since 2.0.0
2736 * @return void
2737 */
2738 protected function render_data()
2739 {
2740 $settings = $this->get_settings_for_display();
2741
2742 if (empty($this->_events)) {
2743
2744 if ('message' !== $settings['no_events']) {
2745 echo $this->render_placeholder([ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- render_placeholder returns safe HTML
2746 'body' => esc_html__('You have no events in your calendar. Check the settings and make sure the source fields for the dates of the events are setup correctly.', 'master-addons' ),
2747 ]);
2748 }
2749
2750 if ('hide' === $settings['no_events']) {
2751 return;
2752 }
2753
2754 if ('message' === $settings['no_events']) {
2755 $this->add_render_attribute('no-events', 'class', 'jltma-calendar__no-events');
2756
2757 ?>
2758 <div <?php echo $this->get_render_attribute_string('no-events'); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Elementor safe attribute string ?>>
2759 <?php echo $this->parse_text_editor($settings['no_events_message']); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- parse_text_editor returns safe HTML ?>
2760 </div>
2761 <?php
2762 return;
2763 }
2764 }
2765
2766 $this->add_render_attribute([
2767 'calendar' => [
2768 'class' => [
2769 'jltma-calendar',
2770 ],
2771 ],
2772 ]);
2773
2774 ?>
2775 <div <?php echo $this->get_render_attribute_string('calendar'); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Elementor safe attribute string ?>>
2776 <?php foreach ($this->_events as $index => $event) {
2777
2778 if (!$event['start'])
2779 continue;
2780
2781 $title = $event['title'];
2782 $start = $event['start'];
2783 $end = (!empty($event['end'])) ? $event['end'] : $event['start'];
2784 $link = $event['link'];
2785 $target = $event['target'];
2786 $rel = $event['rel'];
2787 $archive = $event['archive'];
2788
2789 $event_key = $this->get_repeater_setting_key('event', 'events', $index);
2790
2791 $this->add_render_attribute($event_key, [
2792 'class' => 'jltma-calendar-event',
2793 'data-archive' => $archive,
2794 'data-target' => $target,
2795 'data-rel' => $rel,
2796 'data-link' => $link,
2797 'data-start' => $start,
2798 'data-end' => $end,
2799 'data-before' => $this->get_before_title($event),
2800 'data-after' => $this->get_after_title($event),
2801 ]);
2802 ?>
2803 <div <?php echo $this->get_render_attribute_string($event_key); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Elementor safe attribute string ?>>
2804 <?php echo $this->parse_text_editor($title); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- parse_text_editor returns safe HTML
2805 ?>
2806 </div>
2807 <?php } ?>
2808
2809 </div>
2810
2811 <?php
2812 }
2813
2814 /**
2815 * Output before title
2816 *
2817 * @since 2.2.0
2818 * @return void
2819 */
2820 public function get_before_title($event)
2821 {
2822
2823 ob_start();
2824
2825 /**
2826 * Before title.
2827 *
2828 * Fires before printing the title of the event.
2829 *
2830 * @since 2.2.0
2831 *
2832 * @param array $event The event data.
2833 */
2834 do_action('master_addons/widgets/calendar/event/before_title', $event);
2835
2836 return ob_get_clean();
2837 }
2838
2839 /**
2840 * Output after title
2841 *
2842 * @since 2.2.0
2843 * @return void
2844 */
2845 public function get_after_title($event)
2846 {
2847
2848 ob_start();
2849
2850 /**
2851 * Before title.
2852 *
2853 * Fires after printing the title of the event.
2854 *
2855 * @since 2.2.0
2856 *
2857 * @param array $event The event data.
2858 */
2859 do_action('master_addons/widgets/calendar/event/after_title', $event);
2860
2861 return ob_get_clean();
2862 }
2863
2864 /**
2865 * Content Template
2866 *
2867 * Javascript content template for quick rendering. None in this case
2868 *
2869 * @since 2.0.0
2870 * @return void
2871 */
2872 protected function content_template()
2873 {
2874 }
2875 }
2876