PluginProbe
Ultimate Post Kit – Elementor Post Grid, Post Carousel, Post Slider & Blog Layout Widgets / 4.1.13
Ultimate Post Kit – Elementor Post Grid, Post Carousel, Post Slider & Blog Layout Widgets v4.1.13
4.5.6 4.5.5 4.5.4 4.2.1 4.2.2 4.2.3 4.5.0 4.5.2 4.5.3 4.2.0 4.1.18 4.1.17 4.1.16 4.1.15 4.1.14 4.1.13 4.1.12 4.1.11 4.1.10 4.1.9 4.1.8 4.0.9 4.1.0 4.1.1 4.1.2 All 148 releases
ultimate-post-kit / modules / newsletter / widgets / newsletter.php

newsletter.php in Ultimate Post Kit – Elementor Post Grid, Post Carousel, Post Slider & Blog Layout Widgets 4.1.13, at modules/newsletter/widgets/newsletter.php

1,106 lines 29.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace UltimatePostKit\Modules\Newsletter\Widgets;
4
5 use UltimatePostKit\Base\Module_Base;
6 use Elementor\Controls_Manager;
7 use Elementor\Group_Control_Border;
8 use Elementor\Group_Control_Typography;
9 use Elementor\Group_Control_Box_Shadow;
10 use Elementor\Group_Control_Background;
11 use Elementor\Icons_Manager;
12
13 if (!defined('ABSPATH')) exit; // Exit if accessed directly
14
15 class Newsletter extends Module_Base {
16
17 public function get_name() {
18 return 'upk-newsletter';
19 }
20
21 public function get_title() {
22 return BDTUPK . esc_html__('Newsletter', 'ultimate-post-kit');
23 }
24
25 public function get_icon() {
26 return 'upk-widget-icon upk-icon-newsletter';
27 }
28
29 public function get_categories() {
30 return ['ultimate-post-kit'];
31 }
32
33 public function get_keywords() {
34 return ['newsletter', 'email', 'marketing', 'newsletter'];
35 }
36
37 public function get_style_depends() {
38 if ($this->upk_is_edit_mode()) {
39 return ['upk-all-styles'];
40 } else {
41 return ['upk-newsletter'];
42 }
43 }
44
45 public function get_script_depends() {
46 if ($this->upk_is_edit_mode()) {
47 return ['upk-all-scripts'];
48 } else {
49 return ['upk-newsletter'];
50 }
51 }
52
53 public function get_custom_help_url() {
54 return 'https://youtu.be/8ZgQVoSPEyw';
55 }
56
57 public function has_widget_inner_wrapper(): bool {
58 return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
59 }
60
61
62 protected function register_controls() {
63
64 $this->start_controls_section(
65 'section_content_layout',
66 [
67 'label' => esc_html__('Layout', 'ultimate-post-kit'),
68 ]
69 );
70
71 $this->add_control(
72 'show_before_icon',
73 [
74 'label' => esc_html__('Before Icon', 'ultimate-post-kit'),
75 'type' => Controls_Manager::SWITCHER,
76 ]
77 );
78
79 $this->add_control(
80 'mailchimp_before_icon',
81 [
82 'label' => __('Choose Icon', 'ultimate-post-kit'),
83 'type' => Controls_Manager::ICONS,
84 'default' => [
85 'value' => 'far fa-envelope-open',
86 'library' => 'fa-regular',
87 ],
88 'condition' => [
89 'show_before_icon' => 'yes'
90 ],
91 'label_block' => false,
92 'skin' => 'inline'
93 ]
94 );
95
96 $this->add_control(
97 'hr_1',
98 [
99 'type' => Controls_Manager::DIVIDER,
100 'condition' => [
101 'show_before_icon' => 'yes'
102 ]
103 ]
104 );
105
106 $this->add_control(
107 'before_text',
108 [
109 'label' => esc_html__('Before Text', 'ultimate-post-kit'),
110 'type' => Controls_Manager::TEXT,
111 'dynamic' => ['active' => true],
112 'placeholder' => esc_html__('Before Text', 'ultimate-post-kit'),
113 ]
114 );
115
116 $this->add_control(
117 'after_text',
118 [
119 'label' => esc_html__('After Text', 'ultimate-post-kit'),
120 'type' => Controls_Manager::TEXT,
121 'dynamic' => ['active' => true],
122 'placeholder' => esc_html__('After Text', 'ultimate-post-kit'),
123 ]
124 );
125
126 $this->add_responsive_control(
127 'align',
128 [
129 'label' => __('Alignment', 'ultimate-post-kit'),
130 'type' => Controls_Manager::CHOOSE,
131 'options' => [
132 'left' => [
133 'title' => __('Left', 'ultimate-post-kit'),
134 'icon' => 'eicon-text-align-left',
135 ],
136 'center' => [
137 'title' => __('Center', 'ultimate-post-kit'),
138 'icon' => 'eicon-text-align-center',
139 ],
140 'right' => [
141 'title' => __('Right', 'ultimate-post-kit'),
142 'icon' => 'eicon-text-align-right',
143 ],
144 'justify' => [
145 'title' => __('Justified', 'ultimate-post-kit'),
146 'icon' => 'eicon-text-align-justify',
147 ],
148 ],
149 'conditions' => [
150 'relation' => 'or',
151 'terms' => [
152 [
153 'name' => 'before_text',
154 'operator' => '!=',
155 'value' => '',
156 ],
157 [
158 'name' => 'after_text',
159 'operator' => '!=',
160 'value' => '',
161 ],
162 ],
163 ],
164 'selectors' => [
165 '{{WRAPPER}} .upk-newsletter-wrapper .upk-newsletter-before-text, {{WRAPPER}} .upk-newsletter-wrapper .upk-newsletter-after-text' => 'text-align: {{VALUE}};',
166 ],
167 ]
168 );
169
170 $this->add_control(
171 'hr_2',
172 [
173 'type' => Controls_Manager::DIVIDER,
174 'conditions' => [
175 'relation' => 'or',
176 'terms' => [
177 [
178 'name' => 'before_text',
179 'operator' => '!=',
180 'value' => '',
181 ],
182 [
183 'name' => 'after_text',
184 'operator' => '!=',
185 'value' => '',
186 ],
187 ],
188 ]
189 ]
190 );
191
192 $this->add_control(
193 'email_field_placeholder',
194 [
195 'label' => esc_html__('Email Field Placeholder', 'ultimate-post-kit'),
196 'type' => Controls_Manager::TEXT,
197 'dynamic' => ['active' => true],
198 'label_block' => true,
199 'default' => esc_html__('Email *', 'ultimate-post-kit'),
200 'placeholder' => esc_html__('Email *', 'ultimate-post-kit'),
201 ]
202 );
203
204 $this->add_control(
205 'show_fname',
206 [
207 'label' => esc_html__('Show Name', 'ultimate-post-kit'),
208 'type' => Controls_Manager::SWITCHER,
209 ]
210 );
211
212 $this->add_control(
213 'fname_field_placeholder',
214 [
215 'label' => esc_html__('Name Field Placeholder', 'ultimate-post-kit'),
216 'type' => Controls_Manager::TEXT,
217 'dynamic' => ['active' => true],
218 'label_block' => true,
219 'default' => esc_html__('Name ', 'ultimate-post-kit'),
220 'placeholder' => esc_html__('Name ', 'ultimate-post-kit'),
221 'condition' => [
222 'show_fname' => 'yes',
223 ]
224 ]
225 );
226
227 $this->add_control(
228 'fullwidth_input',
229 [
230 'label' => esc_html__('Fullwidth Fields', 'ultimate-post-kit'),
231 'type' => Controls_Manager::SWITCHER,
232 'prefix_class' => 'upk-field-full--',
233 ]
234 );
235
236 $this->add_control(
237 'fullwidth_button',
238 [
239 'label' => esc_html__('Fullwidth Button', 'ultimate-post-kit'),
240 'type' => Controls_Manager::SWITCHER,
241 'selectors' => [
242 '{{WRAPPER}} .upk-newsletter-wrapper .upk-newsletter-btn' => 'width: 100%;',
243 ],
244 'condition' => [
245 'fullwidth_input' => 'yes',
246 ],
247 ]
248 );
249
250 $this->end_controls_section();
251
252 $this->start_controls_section(
253 'section_content_button',
254 [
255 'label' => esc_html__('Signup Button', 'ultimate-post-kit'),
256 ]
257 );
258
259 $this->add_control(
260 'button_text',
261 [
262 'label' => esc_html__('Button Text', 'ultimate-post-kit'),
263 'type' => Controls_Manager::TEXT,
264 'dynamic' => ['active' => true],
265 'placeholder' => esc_html__('SIGNUP', 'ultimate-post-kit'),
266 'default' => esc_html__('SIGNUP', 'ultimate-post-kit'),
267 ]
268 );
269
270 $this->add_control(
271 'mailchimp_button_icon',
272 [
273 'label' => __('Icon', 'ultimate-post-kit'),
274 'type' => Controls_Manager::ICONS,
275 'label_block' => false,
276 'skin' => 'inline'
277 ]
278 );
279
280 $this->add_control(
281 'icon_align',
282 [
283 'label' => __('Icon Position', 'ultimate-post-kit'),
284 'type' => Controls_Manager::SELECT,
285 'default' => 'right',
286 'options' => [
287 'left' => __('Left', 'ultimate-post-kit'),
288 'right' => __('Right', 'ultimate-post-kit'),
289 ],
290 'condition' => [
291 'mailchimp_button_icon[value]!' => '',
292 ],
293 ]
294 );
295
296 $this->add_responsive_control(
297 'icon_indent',
298 [
299 'label' => __('Icon Spacing', 'ultimate-post-kit'),
300 'type' => Controls_Manager::SLIDER,
301 'range' => [
302 'px' => [
303 'max' => 100,
304 ],
305 ],
306 'default' => [
307 'size' => 8,
308 ],
309 'condition' => [
310 'mailchimp_button_icon[value]!' => '',
311 ],
312 'selectors' => [
313 '{{WRAPPER}} .upk-newsletter-btn .upk-flex-align-right' => is_rtl() ? 'margin-right: {{SIZE}}{{UNIT}};' : 'margin-left: {{SIZE}}{{UNIT}};',
314 '{{WRAPPER}} .upk-newsletter-btn .upk-flex-align-left' => is_rtl() ? 'margin-left: {{SIZE}}{{UNIT}};' : 'margin-right: {{SIZE}}{{UNIT}};',
315 ],
316 ]
317 );
318
319 $this->end_controls_section();
320
321 $this->start_controls_section(
322 'section_style_before_icon',
323 [
324 'label' => __('Before Icon', 'ultimate-post-kit'),
325 'tab' => Controls_Manager::TAB_STYLE,
326 'condition' => [
327 'show_before_icon' => 'yes',
328 'mailchimp_before_icon[value]!' => '',
329 ],
330 ]
331 );
332
333 $this->start_controls_tabs('tabs_before_icon_style');
334
335 $this->start_controls_tab(
336 'tab_before_icon_normal',
337 [
338 'label' => __('Normal', 'ultimate-post-kit'),
339 ]
340 );
341
342 $this->add_control(
343 'before_icon_color',
344 [
345 'label' => __('Color', 'ultimate-post-kit'),
346 'type' => Controls_Manager::COLOR,
347 'selectors' => [
348 '{{WRAPPER}} .upk-newsletter-before-icon' => 'color: {{VALUE}};',
349 '{{WRAPPER}} .upk-newsletter-before-icon svg *' => 'fill: {{VALUE}};',
350 ],
351 ]
352 );
353
354 $this->add_group_control(
355 Group_Control_Background::get_type(),
356 [
357 'name' => 'before_icon_background',
358 'selector' => '{{WRAPPER}} .upk-newsletter-before-icon',
359 ]
360 );
361
362 $this->add_group_control(
363 Group_Control_Border::get_type(),
364 [
365 'name' => 'before_icon_border',
366 'placeholder' => '1px',
367 'default' => '1px',
368 'selector' => '{{WRAPPER}} .upk-newsletter-before-icon',
369 ]
370 );
371
372 $this->add_responsive_control(
373 'before_icon_radius',
374 [
375 'label' => __('Border Radius', 'ultimate-post-kit'),
376 'type' => Controls_Manager::DIMENSIONS,
377 'size_units' => ['px', '%'],
378 'selectors' => [
379 '{{WRAPPER}} .upk-newsletter-before-icon' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
380 ],
381 ]
382 );
383
384 $this->add_responsive_control(
385 'before_icon_padding',
386 [
387 'label' => __('Padding', 'ultimate-post-kit'),
388 'type' => Controls_Manager::DIMENSIONS,
389 'size_units' => ['px', 'em', '%'],
390 'selectors' => [
391 '{{WRAPPER}} .upk-newsletter-before-icon' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
392 ],
393 ]
394 );
395
396 $this->add_responsive_control(
397 'before_icon_margin',
398 [
399 'label' => __('Margin', 'ultimate-post-kit'),
400 'type' => Controls_Manager::DIMENSIONS,
401 'size_units' => ['px', 'em', '%'],
402 'selectors' => [
403 '{{WRAPPER}} .upk-newsletter-before-icon' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
404 ],
405 ]
406 );
407
408 $this->add_group_control(
409 Group_Control_Box_Shadow::get_type(),
410 [
411 'name' => 'before_icon_shadow',
412 'selector' => '{{WRAPPER}} .upk-newsletter-before-icon',
413 ]
414 );
415
416 $this->add_responsive_control(
417 'before_icon_size',
418 [
419 'label' => __('Size', 'ultimate-post-kit'),
420 'type' => Controls_Manager::SLIDER,
421 'selectors' => [
422 '{{WRAPPER}} .upk-newsletter-wrapper .upk-newsletter-before-icon' => 'font-size: {{SIZE}}{{UNIT}};',
423 ],
424 ]
425 );
426
427 $this->end_controls_tab();
428
429 $this->start_controls_tab(
430 'tab_before_icon_hover',
431 [
432 'label' => __('Hover', 'ultimate-post-kit'),
433 ]
434 );
435
436 $this->add_control(
437 'before_icon_hover_color',
438 [
439 'label' => __('Color', 'ultimate-post-kit'),
440 'type' => Controls_Manager::COLOR,
441 'selectors' => [
442 '{{WRAPPER}} .upk-newsletter-before-icon:hover' => 'color: {{VALUE}};',
443 '{{WRAPPER}} .upk-newsletter-before-icon:hover svg' => 'fill: {{VALUE}};',
444 ],
445 ]
446 );
447
448 $this->add_group_control(
449 Group_Control_Background::get_type(),
450 [
451 'name' => 'before_icon_hover_background',
452 'selector' => '{{WRAPPER}} .upk-newsletter-before-icon:hover',
453 ]
454 );
455
456 $this->add_control(
457 'before_icon_hover_border_color',
458 [
459 'label' => __('Border Color', 'ultimate-post-kit'),
460 'type' => Controls_Manager::COLOR,
461 'condition' => [
462 'before_icon_border_border!' => '',
463 ],
464 'selectors' => [
465 '{{WRAPPER}} .upk-newsletter-before-icon:hover' => 'border-color: {{VALUE}};',
466 ],
467 ]
468 );
469
470 $this->end_controls_tab();
471
472 $this->end_controls_tabs();
473
474 $this->end_controls_section();
475
476 $this->start_controls_section(
477 'section_style_input',
478 [
479 'label' => esc_html__('Field', 'ultimate-post-kit'),
480 'tab' => Controls_Manager::TAB_STYLE,
481 ]
482 );
483
484 $this->start_controls_tabs('tabs_input_style');
485
486 $this->start_controls_tab(
487 'tab_input_normal',
488 [
489 'label' => esc_html__('Normal', 'ultimate-post-kit'),
490 ]
491 );
492
493 $this->add_control(
494 'input_placeholder_color',
495 [
496 'label' => esc_html__('Placeholder Color', 'ultimate-post-kit'),
497 'type' => Controls_Manager::COLOR,
498 'selectors' => [
499 '{{WRAPPER}} .upk-newsletter-wrapper input[type*="email"]::placeholder, {{WRAPPER}} .upk-newsletter-wrapper input[type*="text"]::placeholder' => 'color: {{VALUE}};',
500 ],
501 ]
502 );
503
504 $this->add_control(
505 'input_color',
506 [
507 'label' => esc_html__('Text Color', 'ultimate-post-kit'),
508 'type' => Controls_Manager::COLOR,
509 'selectors' => [
510 '{{WRAPPER}} .upk-newsletter-wrapper .upk-input' => 'color: {{VALUE}};',
511 ],
512 ]
513 );
514
515 $this->add_group_control(
516 Group_Control_Background::get_type(),
517 [
518 'name' => 'input_background',
519 'selector' => '{{WRAPPER}} .upk-newsletter-wrapper .upk-input',
520 ]
521 );
522
523 $this->add_group_control(
524 Group_Control_Border::get_type(),
525 [
526 'name' => 'input_border',
527 'placeholder' => '1px',
528 'default' => '1px',
529 'selector' => '{{WRAPPER}} .upk-newsletter-wrapper .upk-input',
530 ]
531 );
532
533 $this->add_responsive_control(
534 'input_radius',
535 [
536 'label' => esc_html__('Border Radius', 'ultimate-post-kit'),
537 'type' => Controls_Manager::DIMENSIONS,
538 'size_units' => ['px', '%'],
539 'selectors' => [
540 '{{WRAPPER}} .upk-newsletter-wrapper .upk-input' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
541 ],
542 ]
543 );
544
545 $this->add_responsive_control(
546 'input_padding',
547 [
548 'label' => esc_html__('Padding', 'ultimate-post-kit'),
549 'type' => Controls_Manager::DIMENSIONS,
550 'size_units' => ['px', 'em', '%'],
551 'selectors' => [
552 '{{WRAPPER}} .upk-newsletter-wrapper .upk-input' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
553 ],
554 ]
555 );
556
557 $this->add_responsive_control(
558 'input_margin',
559 [
560 'label' => esc_html__('Margin', 'ultimate-post-kit'),
561 'type' => Controls_Manager::DIMENSIONS,
562 'size_units' => ['px', 'em', '%'],
563 'selectors' => [
564 '{{WRAPPER}} .upk-newsletter-wrapper .upk-newsletter-input-wrapper' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
565 ],
566 ]
567 );
568
569 $this->add_group_control(
570 Group_Control_Box_Shadow::get_type(),
571 [
572 'name' => 'input_shadow',
573 'selector' => '{{WRAPPER}} .upk-newsletter-wrapper .upk-input',
574 ]
575 );
576
577 $this->add_group_control(
578 Group_Control_Typography::get_type(),
579 [
580 'name' => 'placeholder_typography',
581 'label' => esc_html__('Typography', 'ultimate-post-kit'),
582 'selector' => '{{WRAPPER}} .upk-newsletter-wrapper .upk-input',
583 ]
584 );
585
586 $this->end_controls_tab();
587
588 $this->start_controls_tab(
589 'tab_input_focus',
590 [
591 'label' => esc_html__('Focus', 'ultimate-post-kit'),
592 ]
593 );
594
595 $this->add_control(
596 'input_focus_color',
597 [
598 'label' => esc_html__('Text Color', 'ultimate-post-kit'),
599 'type' => Controls_Manager::COLOR,
600 'selectors' => [
601 '{{WRAPPER}} .upk-newsletter-wrapper input:focus' => 'color: {{VALUE}};',
602 ],
603 ]
604 );
605
606 $this->add_group_control(
607 Group_Control_Background::get_type(),
608 [
609 'name' => 'input_focus_background',
610 'selector' => '{{WRAPPER}} .upk-newsletter-wrapper input:focus',
611 ]
612 );
613
614 $this->add_control(
615 'input_focus_border_color',
616 [
617 'label' => esc_html__('Border Color', 'ultimate-post-kit'),
618 'type' => Controls_Manager::COLOR,
619 'condition' => [
620 'input_border_border!' => '',
621 ],
622 'selectors' => [
623 '{{WRAPPER}} .upk-newsletter-wrapper input:focus' => 'border-color: {{VALUE}};',
624 ],
625 ]
626 );
627
628 $this->end_controls_tab();
629
630 $this->end_controls_tabs();
631
632 $this->end_controls_section();
633
634 $this->start_controls_section(
635 'section_style_button',
636 [
637 'label' => esc_html__('Sign Up Button', 'ultimate-post-kit'),
638 'tab' => Controls_Manager::TAB_STYLE,
639 ]
640 );
641
642 $this->start_controls_tabs('tabs_button_style');
643
644 $this->start_controls_tab(
645 'tab_button_normal',
646 [
647 'label' => esc_html__('Normal', 'ultimate-post-kit'),
648 ]
649 );
650
651 $this->add_control(
652 'button_text_color',
653 [
654 'label' => esc_html__('Color', 'ultimate-post-kit'),
655 'type' => Controls_Manager::COLOR,
656 'selectors' => [
657 '{{WRAPPER}} .upk-newsletter-wrapper .upk-newsletter-btn' => 'color: {{VALUE}};',
658 ],
659 ]
660 );
661
662 $this->add_group_control(
663 Group_Control_Background::get_type(),
664 [
665 'name' => 'button_background_color',
666 'selector' => '{{WRAPPER}} .upk-newsletter-wrapper .upk-newsletter-btn',
667 ]
668 );
669
670 $this->add_group_control(
671 Group_Control_Border::get_type(),
672 [
673 'name' => 'button_border',
674 'placeholder' => '1px',
675 'default' => '1px',
676 'selector' => '{{WRAPPER}} .upk-newsletter-wrapper .upk-newsletter-btn',
677 ]
678 );
679
680 $this->add_responsive_control(
681 'button_radius',
682 [
683 'label' => esc_html__('Border Radius', 'ultimate-post-kit'),
684 'type' => Controls_Manager::DIMENSIONS,
685 'size_units' => ['px', '%'],
686 'selectors' => [
687 '{{WRAPPER}} .upk-newsletter-wrapper .upk-newsletter-btn' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
688 ],
689 ]
690 );
691
692 $this->add_responsive_control(
693 'button_text_padding',
694 [
695 'label' => esc_html__('Padding', 'ultimate-post-kit'),
696 'type' => Controls_Manager::DIMENSIONS,
697 'size_units' => ['px', 'em', '%'],
698 'selectors' => [
699 '{{WRAPPER}} .upk-newsletter-wrapper .upk-newsletter-btn' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
700 ],
701 ]
702 );
703
704 $this->add_group_control(
705 Group_Control_Box_Shadow::get_type(),
706 [
707 'name' => 'button_shadow',
708 'selector' => '{{WRAPPER}} .upk-newsletter-wrapper .upk-newsletter-btn',
709 ]
710 );
711
712 $this->add_group_control(
713 Group_Control_Typography::get_type(),
714 [
715 'name' => 'button_typography',
716 'label' => esc_html__('Typography', 'ultimate-post-kit'),
717 'selector' => '{{WRAPPER}} .upk-newsletter-wrapper .upk-newsletter-btn',
718 ]
719 );
720
721 $this->end_controls_tab();
722
723 $this->start_controls_tab(
724 'tab_button_hover',
725 [
726 'label' => esc_html__('Hover', 'ultimate-post-kit'),
727 ]
728 );
729
730 $this->add_control(
731 'hover_color',
732 [
733 'label' => esc_html__('Color', 'ultimate-post-kit'),
734 'type' => Controls_Manager::COLOR,
735 'selectors' => [
736 '{{WRAPPER}} .upk-newsletter-wrapper .upk-newsletter-btn:hover' => 'color: {{VALUE}};',
737 ],
738 ]
739 );
740
741 $this->add_group_control(
742 Group_Control_Background::get_type(),
743 [
744 'name' => 'button_background_hover_color',
745 'selector' => '{{WRAPPER}} .upk-newsletter-wrapper .upk-newsletter-btn:hover',
746 ]
747 );
748
749 $this->add_control(
750 'button_hover_border_color',
751 [
752 'label' => esc_html__('Border Color', 'ultimate-post-kit'),
753 'type' => Controls_Manager::COLOR,
754 'condition' => [
755 'button_border_border!' => '',
756 ],
757 'selectors' => [
758 '{{WRAPPER}} .upk-newsletter-wrapper .upk-newsletter-btn:hover' => 'border-color: {{VALUE}};',
759 ],
760 ]
761 );
762
763 $this->add_control(
764 'hover_animation',
765 [
766 'label' => __('Hover Animation', 'ultimate-post-kit'),
767 'type' => Controls_Manager::HOVER_ANIMATION,
768 ]
769 );
770
771 $this->end_controls_tab();
772
773 $this->end_controls_tabs();
774
775 $this->end_controls_section();
776
777 $this->start_controls_section(
778 'section_style_icon',
779 [
780 'label' => __('Signup Button Icon', 'ultimate-post-kit'),
781 'tab' => Controls_Manager::TAB_STYLE,
782 'condition' => [
783 'mailchimp_button_icon[value]!' => '',
784 ],
785 ]
786 );
787
788 $this->start_controls_tabs('tabs_signup_btn_icon_style');
789
790 $this->start_controls_tab(
791 'tab_signup_btn_icon_normal',
792 [
793 'label' => __('Normal', 'ultimate-post-kit'),
794 ]
795 );
796
797 $this->add_control(
798 'signup_btn_icon_color',
799 [
800 'label' => __('Color', 'ultimate-post-kit'),
801 'type' => Controls_Manager::COLOR,
802 'selectors' => [
803 '{{WRAPPER}} .upk-newsletter-btn .upk-newsletter-btn-icon i' => 'color: {{VALUE}};',
804 '{{WRAPPER}} .upk-newsletter-btn .upk-newsletter-btn-icon svg *' => 'fill: {{VALUE}};',
805 ],
806 ]
807 );
808
809 $this->add_group_control(
810 Group_Control_Background::get_type(),
811 [
812 'name' => 'signup_btn_icon_background',
813 'selector' => '{{WRAPPER}} .upk-newsletter-btn .upk-newsletter-btn-icon',
814 ]
815 );
816
817 $this->add_group_control(
818 Group_Control_Border::get_type(),
819 [
820 'name' => 'signup_btn_icon_border',
821 'placeholder' => '1px',
822 'default' => '1px',
823 'selector' => '{{WRAPPER}} .upk-newsletter-btn .upk-newsletter-btn-icon',
824 ]
825 );
826
827 $this->add_responsive_control(
828 'signup_btn_icon_radius',
829 [
830 'label' => __('Border Radius', 'ultimate-post-kit'),
831 'type' => Controls_Manager::DIMENSIONS,
832 'size_units' => ['px', '%'],
833 'selectors' => [
834 '{{WRAPPER}} .upk-newsletter-btn .upk-newsletter-btn-icon' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
835 ],
836 ]
837 );
838
839 $this->add_responsive_control(
840 'signup_btn_icon_padding',
841 [
842 'label' => __('Padding', 'ultimate-post-kit'),
843 'type' => Controls_Manager::DIMENSIONS,
844 'size_units' => ['px', 'em', '%'],
845 'selectors' => [
846 '{{WRAPPER}} .upk-newsletter-btn .upk-newsletter-btn-icon' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
847 ],
848 ]
849 );
850
851 $this->add_responsive_control(
852 'signup_btn_icon_margin',
853 [
854 'label' => __('Margin', 'ultimate-post-kit'),
855 'type' => Controls_Manager::DIMENSIONS,
856 'size_units' => ['px', 'em', '%'],
857 'selectors' => [
858 '{{WRAPPER}} .upk-newsletter-btn .upk-newsletter-btn-icon' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
859 ],
860 ]
861 );
862
863 $this->add_group_control(
864 Group_Control_Box_Shadow::get_type(),
865 [
866 'name' => 'signup_btn_icon_shadow',
867 'selector' => '{{WRAPPER}} .upk-newsletter-btn .upk-newsletter-btn-icon',
868 ]
869 );
870
871 $this->add_responsive_control(
872 'signup_btn_icon_size',
873 [
874 'label' => __('Size', 'ultimate-post-kit'),
875 'type' => Controls_Manager::SLIDER,
876 'selectors' => [
877 '{{WRAPPER}} .upk-newsletter-btn .upk-newsletter-btn-icon' => 'font-size: {{SIZE}}{{UNIT}};',
878 ],
879 ]
880 );
881
882 $this->end_controls_tab();
883
884 $this->start_controls_tab(
885 'tab_signup_btn_icon_hover',
886 [
887 'label' => __('Hover', 'ultimate-post-kit'),
888 ]
889 );
890
891 $this->add_control(
892 'signup_btn_icon_hover_color',
893 [
894 'label' => __('Color', 'ultimate-post-kit'),
895 'type' => Controls_Manager::COLOR,
896 'selectors' => [
897 '{{WRAPPER}} .upk-newsletter-btn:hover .upk-newsletter-btn-icon i' => 'color: {{VALUE}};',
898 '{{WRAPPER}} .upk-newsletter-btn:hover .upk-newsletter-btn-icon svg *' => 'fill: {{VALUE}};',
899 ],
900 ]
901 );
902
903 $this->add_group_control(
904 Group_Control_Background::get_type(),
905 [
906 'name' => 'signup_btn_icon_hover_background',
907 'selector' => '{{WRAPPER}} .upk-newsletter-btn:hover .upk-newsletter-btn-icon',
908 ]
909 );
910
911 $this->add_control(
912 'icon_hover_border_color',
913 [
914 'label' => __('Border Color', 'ultimate-post-kit'),
915 'type' => Controls_Manager::COLOR,
916 'condition' => [
917 'signup_btn_icon_border_border!' => '',
918 ],
919 'selectors' => [
920 '{{WRAPPER}} .upk-newsletter-btn:hover .upk-newsletter-btn-icon' => 'border-color: {{VALUE}};',
921 ],
922 ]
923 );
924
925 $this->end_controls_tab();
926
927 $this->end_controls_tabs();
928
929 $this->end_controls_section();
930
931 $this->start_controls_section(
932 'section_style_before_text',
933 [
934 'label' => __('Before Text', 'ultimate-post-kit'),
935 'tab' => Controls_Manager::TAB_STYLE,
936 'condition' => [
937 'before_text!' => '',
938 ],
939 ]
940 );
941
942 $this->add_control(
943 'before_text_color',
944 [
945 'label' => __('Color', 'ultimate-post-kit'),
946 'type' => Controls_Manager::COLOR,
947 'selectors' => [
948 '{{WRAPPER}} .upk-newsletter-wrapper .upk-newsletter-before-text' => 'color: {{VALUE}};',
949 ],
950 ]
951 );
952
953 $this->add_responsive_control(
954 'before_text_spacing',
955 [
956 'label' => __('Spacing', 'ultimate-post-kit'),
957 'type' => Controls_Manager::SLIDER,
958 'selectors' => [
959 '{{WRAPPER}} .upk-newsletter-wrapper .upk-newsletter-before-text' => 'margin-bottom: {{SIZE}}{{UNIT}};',
960 ],
961 ]
962 );
963
964 $this->add_group_control(
965 Group_Control_Typography::get_type(),
966 [
967 'name' => 'before_text_typography',
968 'label' => esc_html__('Typography', 'ultimate-post-kit'),
969 'selector' => '{{WRAPPER}} .upk-newsletter-wrapper .upk-newsletter-before-text',
970 ]
971 );
972
973 $this->end_controls_section();
974
975 $this->start_controls_section(
976 'section_style_after_text',
977 [
978 'label' => __('After Text', 'ultimate-post-kit'),
979 'tab' => Controls_Manager::TAB_STYLE,
980 'condition' => [
981 'after_text!' => '',
982 ],
983 ]
984 );
985
986 $this->add_control(
987 'after_text_color',
988 [
989 'label' => __('Color', 'ultimate-post-kit'),
990 'type' => Controls_Manager::COLOR,
991 'selectors' => [
992 '{{WRAPPER}} .upk-newsletter-wrapper .upk-newsletter-after-text' => 'color: {{VALUE}};',
993 ],
994 ]
995 );
996
997 $this->add_responsive_control(
998 'after_text_spacing',
999 [
1000 'label' => __('Spacing', 'ultimate-post-kit'),
1001 'type' => Controls_Manager::SLIDER,
1002 'selectors' => [
1003 '{{WRAPPER}} .upk-newsletter-wrapper .upk-newsletter-after-text' => 'margin-top: {{SIZE}}{{UNIT}};',
1004 ],
1005 ]
1006 );
1007
1008 $this->add_group_control(
1009 Group_Control_Typography::get_type(),
1010 [
1011 'name' => 'after_text_typography',
1012 'label' => esc_html__('Typography', 'ultimate-post-kit'),
1013 'selector' => '{{WRAPPER}} .upk-newsletter-wrapper .upk-newsletter-after-text',
1014 ]
1015 );
1016
1017 $this->end_controls_section();
1018 }
1019
1020 public function render_text($settings) {
1021
1022 $this->add_render_attribute('content-wrapper', 'class', 'upk-newsletter-btn-content-wrapper');
1023
1024 if ('left' == $settings['icon_align'] or 'right' == $settings['icon_align']) {
1025 $this->add_render_attribute('content-wrapper', 'class', 'upk-flex upk-flex-middle upk-flex-center');
1026 }
1027
1028 $this->add_render_attribute('icon-align', 'class', 'elementor-align-icon-' . $settings['icon_align']);
1029 $this->add_render_attribute('icon-align', 'class', 'upk-newsletter-btn-icon');
1030
1031 $this->add_render_attribute('text', 'class', ['upk-newsletter-btn-text']);
1032 $this->add_inline_editing_attributes('text', 'none');
1033
1034 ?>
1035 <div <?php $this->print_render_attribute_string('content-wrapper'); ?>>
1036 <?php if (!empty($settings['mailchimp_button_icon']['value'])) : ?>
1037 <div class="upk-newsletter-btn-icon upk-flex-align-<?php echo esc_attr($settings['icon_align']); ?>">
1038
1039 <?php Icons_Manager::render_icon($settings['mailchimp_button_icon'], ['aria-hidden' => 'true', 'class' => 'fa-fw']); ?>
1040
1041 </div>
1042 <?php endif; ?>
1043 <div <?php $this->print_render_attribute_string('text'); ?>><?php echo wp_kses($settings['button_text'], ultimate_post_kit_allow_tags('title')); ?></div>
1044 </div>
1045 <?php
1046 }
1047
1048 public function render() {
1049 $settings = $this->get_settings_for_display();
1050 $this->add_render_attribute('input-wrapper', 'class', 'upk-newsletter-input-wrapper');
1051 ?>
1052 <div class="upk-newsletter-wrapper">
1053
1054 <?php if (!empty($settings['before_text'])) : ?>
1055 <div class="upk-newsletter-before-text"><?php echo esc_html($settings['before_text']); ?></div>
1056 <?php endif; ?>
1057
1058 <form action="<?php echo esc_url(site_url()) ?>/wp-admin/admin-ajax.php" class="upk-newsletter">
1059
1060 <?php if ($settings['show_before_icon'] and !empty($settings['mailchimp_before_icon']['value'])) : ?>
1061 <div class="upk-newsletter-before-icon">
1062
1063 <?php Icons_Manager::render_icon($settings['mailchimp_before_icon'], ['aria-hidden' => 'true', 'class' => 'fa-fw']); ?>
1064
1065 </div>
1066 <?php endif; ?>
1067
1068 <?php if ($settings['show_fname'] == 'yes') : ?>
1069 <div <?php $this->print_render_attribute_string('input-wrapper'); ?>>
1070 <input type="text" name="fname" placeholder="<?php echo esc_html($settings['fname_field_placeholder']); ?>" class="upk-input" />
1071 </div>
1072 <?php endif; ?>
1073
1074 <div <?php $this->print_render_attribute_string('input-wrapper'); ?>>
1075 <input type="email" name="email" placeholder="<?php echo esc_html($settings['email_field_placeholder']); ?>" required class="upk-input" />
1076 <input type="hidden" name="action" value="ultimate_post_kit_mailchimp_subscribe" />
1077 <!-- we need action parameter to receive ajax request in WordPress -->
1078 </div>
1079 <?php
1080
1081 $this->add_render_attribute('signup_button', 'class', ['upk-newsletter-btn']);
1082
1083 if ($settings['hover_animation']) {
1084 $this->add_render_attribute('signup_button', 'class', 'elementor-animation-' . $settings['hover_animation']);
1085 }
1086
1087 ?>
1088 <div class="upk-newsletter-signup-wrapper">
1089 <button <?php $this->print_render_attribute_string('signup_button'); ?>>
1090 <?php $this->render_text($settings); ?>
1091 </button>
1092 </div>
1093 </form>
1094
1095 <!-- after text -->
1096 <?php if (!empty($settings['after_text'])) : ?>
1097 <div class="upk-newsletter-after-text"><?php echo esc_html($settings['after_text']); ?></div>
1098 <?php endif; ?>
1099
1100 </div><!-- end newsletter-signup -->
1101
1102
1103 <?php
1104 }
1105 }
1106