PluginProbe
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell / 2.8.16
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell v2.8.16
3.13.3 3.13.2 3.13.1 3.13.0 3.12.13 3.12.12 3.12.11 3.12.10 3.12.9 3.12.8 3.12.7 3.12.6 3.12.5 3.12.4 3.12.3 3.12.1 3.12.2 3.12.0 3.11.1 3.11.0 3.10.9 3.10.8 3.10.7 3.10.6 2.8.16 All 261 releases
wpfunnels / includes / core / widgets / elementor / elements / optin.php

optin.php in WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell 2.8.16, at includes/core/widgets/elementor/elements/optin.php

1,982 lines 52.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Opt-in
4 *
5 * @package
6 */
7 namespace WPFunnels\Widgets\Elementor;
8
9 use Elementor\Controls_Manager;
10 use Elementor\Widget_Base;
11 use Elementor\Group_Control_Border;
12 use Elementor\Group_Control_Box_Shadow;
13 use Elementor\Group_Control_Typography;
14 use Elementor\Group_Control_Text_Shadow;
15 use Elementor\Icons_Manager;
16 use Elementor\Core\Schemes\Color as Scheme_Color;
17 use WPFunnels\Data_Store\Wpfnl_Steps_Store_Data;
18 use Elementor\Controls_Stack;
19 use WPFunnels\Wpfnl_functions;
20
21 if (! defined('ABSPATH')) {
22 exit;
23 } // Exit if accessed directly
24
25 /**
26 * Optin form widget
27 *
28 * @since 1.0.0
29 */
30 class OptinForm extends Widget_Base {
31
32
33 /**
34 * Register the widget controls.
35 *
36 * Adds different input fields to allow the user to change and Wpvrize the widget settings.
37 *
38 * @since 1.0.0
39 *
40 * @access protected
41 */
42 protected function init_controls() {
43 if ( version_compare(ELEMENTOR_VERSION, '3.1.0', '>=') ) {
44 $this->register_controls();
45 } else {
46 $this->_register_controls();
47 }
48 }
49
50
51
52 /**
53 * Retrieve the widget name.
54 *
55 * @since 1.0.0
56 *
57 * @access public
58 *
59 * @return string Widget name.
60 */
61 public function get_name()
62 {
63 return 'wpfnl-optin-form';
64 }
65
66
67 /**
68 * Retrieve the widget title.
69 *
70 * @since 1.0.0
71 *
72 * @access public
73 *
74 * @return string Widget title.
75 */
76 public function get_title()
77 {
78 return __('Optin Form', 'wpfnl');
79 }
80
81
82 /**
83 * Retrieve the widget icon.
84 *
85 * @since 1.0.0
86 *
87 * @access public
88 *
89 * @return string Widget icon.
90 */
91 public function get_icon()
92 {
93 return 'eicon-form-horizontal';
94 }
95
96
97 /**
98 * Retrieve the list of categories the widget belongs to.
99 *
100 * Used to determine where to display the widget in the editor.
101 *
102 * Note that currently Elementor supports only one category.
103 * When multiple categories passed, Elementor uses the first one.
104 *
105 * @since 1.0.0
106 *
107 * @access public
108 *
109 * @return array Widget categories.
110 */
111 public function get_categories()
112 {
113 return [ 'wp-funnel' ];
114 }
115
116
117 /**
118 * Retrieve the list of scripts the widget depended on.
119 *
120 * Used to set scripts dependencies required to run the widget.
121 *
122 * @since 1.0.0
123 *
124 * @access public
125 *
126 * @return array Widget scripts dependencies.
127 */
128 public function get_script_depends()
129 {
130 return [ 'optin-form' ];
131 }
132
133
134 /**
135 * Get button sizes.
136 *
137 * Retrieve an array of button sizes.
138 *
139 * @return array An array containing button sizes.
140 *
141 * @since 1.0.0
142 *
143 * @access public
144 */
145 public function get_button_sizes()
146 {
147 return [
148 'xs' => __('Extra Small', 'wpfnl'),
149 'sm' => __('Small', 'wpfnl'),
150 'md' => __('Medium', 'wpfnl'),
151 'lg' => __('Large', 'wpfnl'),
152 'xl' => __('Extra Large', 'wpfnl'),
153 ];
154 }
155
156
157 /**
158 * Register the widget controls.
159 *
160 * @since 1.0.0
161 *
162 * @access protected
163 */
164 protected function register_controls()
165 {
166 $this->register_form_layout_controls();
167 $this->register_form_field_controls();
168 $this->register_form_button_controls();
169 $this->register_clickto_expand_button_controls();
170 $this->register_action_after_submit_controls();
171
172 //-------style tab--------
173 $this->register_form_style_controls();
174 $this->register_input_fields_style_controls();
175 $this->register_button_style_controls();
176 $this->register_clickto_expand_style_controls();
177
178 }
179
180
181 /**
182 * Register the widget controls.
183 *
184 * @since 1.0.0
185 *
186 * @access protected
187 */
188 protected function _register_controls()
189 {
190 $this->register_form_layout_controls();
191 $this->register_form_field_controls();
192 $this->register_form_button_controls();
193 $this->register_clickto_expand_button_controls();
194 $this->register_action_after_submit_controls();
195
196 //-------style tab--------
197 $this->register_form_style_controls();
198 $this->register_input_fields_style_controls();
199 $this->register_button_style_controls();
200 $this->register_clickto_expand_style_controls();
201
202 }
203
204
205 /**
206 * Register Form Layout Controls.
207 *
208 * @since 1.0.0
209 * @access protected
210 */
211 protected function register_form_layout_controls(){
212 $this->start_controls_section(
213 'wpfnl_optin_form_layout_controls', array(
214 'label' => __('Form Layout', 'wpfnl'),
215 )
216 );
217
218 $this->add_control(
219 'optin_form_type',
220 [
221 'label' => __( 'Opt-in Form Type', 'wpfnl' ),
222 'type' => \Elementor\Controls_Manager::SELECT,
223 'default' => 'general-optin',
224 'options' => [
225 'general-optin' => __( 'General Opt-in', 'wpfnl' ),
226 'clickto-expand-optin' => __('Click To Expand', 'wpfnl'),
227 ],
228 ]
229 );
230
231 $this->add_control(
232 'optin_form_layout',
233 [
234 'label' => __( 'Form Style', 'wpfnl' ),
235 'type' => \Elementor\Controls_Manager::SELECT,
236 'default' => '',
237 'options' => [
238 '' => __( 'Default Style', 'wpfnl' ),
239 'form-style1' => __('Form Style-1', 'wpfnl'),
240 'form-style2' => __('Form Style-2', 'wpfnl'),
241 'form-style3' => __('Form Style-3', 'wpfnl'),
242 'form-style4' => __('Form Style-4', 'wpfnl'),
243 ],
244 ]
245 );
246
247
248 $this->end_controls_section();
249 }
250
251
252 /**
253 * Register Form Controls.
254 *
255 * @since 1.0.0
256 * @access protected
257 */
258 protected function register_form_field_controls(){
259 $this->start_controls_section(
260 'wpfnl_optin_form_field_controls', array(
261 'label' => __('Form Fields', 'wpfnl'),
262 )
263 );
264
265 //------Email------
266 $this->add_control(
267 'email_label',
268 [
269 'label' => __('Email Label', 'wpfnl'),
270 'type' => Controls_Manager::TEXT,
271 'default' => __( 'Email', 'wpfnl' ),
272 'label_block' => true,
273 'condition' => [
274 'field_label' => 'yes',
275 ],
276 ]
277 );
278
279 $this->add_control(
280 'email_placeholder',
281 [
282 'label' => __('Email Placeholder Text', 'wpfnl'),
283 'type' => Controls_Manager::TEXT,
284 'default' => __( 'Email', 'wpfnl' ),
285 'label_block' => true,
286 'separator' => 'after'
287 ]
288 );
289
290 //----first name----
291 $this->add_control(
292 'first_name',
293 [
294 'label' => __('First Name', 'wpfnl'),
295 'type' => Controls_Manager::SWITCHER,
296 'label_on' => __( 'Show', 'wpfnl' ),
297 'label_off' => __( 'Hide', 'wpfnl' ),
298 'return_value' => 'yes',
299 'default' => '',
300 ]
301 );
302 $this->add_control(
303 'first_name_label',
304 [
305 'label' => __('First Name Label', 'wpfnl'),
306 'type' => Controls_Manager::TEXT,
307 'default' => __( 'First Name', 'wpfnl' ),
308 'label_block' => true,
309 'condition' => [
310 'first_name' => 'yes',
311 'field_label' => 'yes',
312 ],
313 ]
314 );
315 $this->add_control(
316 'first_name_placeholder',
317 [
318 'label' => __('First Name Placeholder Text', 'wpfnl'),
319 'type' => Controls_Manager::TEXT,
320 'default' => __( 'First Name', 'wpfnl' ),
321 'label_block' => true,
322 'condition' => [
323 'first_name' => 'yes',
324 ],
325 ]
326 );
327 $this->add_control(
328 'is_required_name',
329 [
330 'label' => __('Mark First Name As Required', 'wpfnl'),
331 'type' => Controls_Manager::SWITCHER,
332 'label_on' => __( 'Yes', 'wpfnl' ),
333 'label_off' => __( 'No', 'wpfnl' ),
334 'return_value' => 'yes',
335 'default' => '',
336 'condition' => [
337 'first_name' => 'yes',
338 ],
339 'separator' => 'after'
340 ]
341 );
342
343
344 //---last name---
345 $this->add_control(
346 'last_name',
347 [
348 'label' => __('Last Name', 'wpfnl'),
349 'type' => Controls_Manager::SWITCHER,
350 'label_on' => __( 'Show', 'wpfnl' ),
351 'label_off' => __( 'Hide', 'wpfnl' ),
352 'return_value' => 'yes',
353 'default' => '',
354 ]
355 );
356 $this->add_control(
357 'last_name_label',
358 [
359 'label' => __('Last Name Label', 'wpfnl'),
360 'type' => Controls_Manager::TEXT,
361 'default' => __( 'Last Name', 'wpfnl' ),
362 'label_block' => true,
363 'condition' => [
364 'last_name' => 'yes',
365 'field_label' => 'yes',
366 ],
367 ]
368 );
369 $this->add_control(
370 'last_name_placeholder',
371 [
372 'label' => __('Last Name Placeholder Text', 'wpfnl'),
373 'type' => Controls_Manager::TEXT,
374 'default' => __( 'Last Name', 'wpfnl' ),
375 'label_block' => true,
376 'condition' => [
377 'last_name' => 'yes',
378 ],
379 ]
380 );
381 $this->add_control(
382 'is_required_last_name',
383 [
384 'label' => __('Mark Last Name As Required', 'wpfnl'),
385 'type' => Controls_Manager::SWITCHER,
386 'label_on' => __( 'Yes', 'wpfnl' ),
387 'label_off' => __( 'No', 'wpfnl' ),
388 'return_value' => 'yes',
389 'default' => '',
390 'condition' => [
391 'last_name' => 'yes',
392 ],
393 'separator' => 'after'
394 ]
395 );
396
397
398 //------phone------
399 $this->add_control(
400 'phone',
401 [
402 'label' => __('Phone', 'wpfnl'),
403 'type' => Controls_Manager::SWITCHER,
404 'label_on' => __( 'Show', 'wpfnl' ),
405 'label_off' => __( 'Hide', 'wpfnl' ),
406 'return_value' => 'yes',
407 'default' => '',
408 ]
409 );
410 $this->add_control(
411 'phone_label',
412 [
413 'label' => __('Phone Label', 'wpfnl'),
414 'type' => Controls_Manager::TEXT,
415 'default' => __( 'Phone', 'wpfnl' ),
416 'label_block' => true,
417 'condition' => [
418 'phone' => 'yes',
419 'field_label' => 'yes',
420 ],
421 ]
422 );
423 $this->add_control(
424 'phone_placeholder',
425 [
426 'label' => __('Phone Placeholder Text', 'wpfnl'),
427 'type' => Controls_Manager::TEXT,
428 'default' => __( 'Phone', 'wpfnl' ),
429 'label_block' => true,
430 'condition' => [
431 'phone' => 'yes',
432 ],
433 ]
434 );
435 $this->add_control(
436 'is_required_phone',
437 [
438 'label' => __('Mark Phone As Required', 'wpfnl'),
439 'type' => Controls_Manager::SWITCHER,
440 'label_on' => __( 'Yes', 'wpfnl' ),
441 'label_off' => __( 'No', 'wpfnl' ),
442 'return_value' => 'yes',
443 'default' => '',
444 'condition' => [
445 'phone' => 'yes',
446 ],
447 'separator' => 'after'
448 ]
449 );
450
451
452 //----website url----
453 $this->add_control(
454 'website_url',
455 [
456 'label' => __('Website Url', 'wpfnl'),
457 'type' => Controls_Manager::SWITCHER,
458 'label_on' => __( 'Show', 'wpfnl' ),
459 'label_off' => __( 'Hide', 'wpfnl' ),
460 'return_value' => 'yes',
461 'default' => '',
462 ]
463 );
464 $this->add_control(
465 'website_url_label',
466 [
467 'label' => __('Website Url Label', 'wpfnl'),
468 'type' => Controls_Manager::TEXT,
469 'default' => __( 'Website Url', 'wpfnl' ),
470 'label_block' => true,
471 'condition' => [
472 'website_url' => 'yes',
473 'field_label' => 'yes',
474 ],
475 ]
476 );
477 $this->add_control(
478 'website_url_placeholder',
479 [
480 'label' => __('Website Url Placeholder Text', 'wpfnl'),
481 'type' => Controls_Manager::TEXT,
482 'default' => __( 'Website Url', 'wpfnl' ),
483 'label_block' => true,
484 'condition' => [
485 'website_url' => 'yes',
486 ],
487 ]
488 );
489 $this->add_control(
490 'is_required_website_url',
491 [
492 'label' => __('Mark Website Url As Required', 'wpfnl'),
493 'type' => Controls_Manager::SWITCHER,
494 'label_on' => __( 'Yes', 'wpfnl' ),
495 'label_off' => __( 'No', 'wpfnl' ),
496 'return_value' => 'yes',
497 'default' => '',
498 'condition' => [
499 'website_url' => 'yes',
500 ],
501 'separator' => 'after'
502 ]
503 );
504
505
506 //-----message------
507 $this->add_control(
508 'message',
509 [
510 'label' => __('Message', 'wpfnl'),
511 'type' => Controls_Manager::SWITCHER,
512 'label_on' => __( 'Show', 'wpfnl' ),
513 'label_off' => __( 'Hide', 'wpfnl' ),
514 'return_value' => 'yes',
515 'default' => '',
516 ]
517 );
518 $this->add_control(
519 'message_label',
520 [
521 'label' => __('Message Label', 'wpfnl'),
522 'type' => Controls_Manager::TEXT,
523 'default' => __( 'Message', 'wpfnl' ),
524 'label_block' => true,
525 'condition' => [
526 'message' => 'yes',
527 'field_label' => 'yes',
528 ],
529 ]
530 );
531 $this->add_control(
532 'message_placeholder',
533 [
534 'label' => __('Message Placeholder Text', 'wpfnl'),
535 'type' => Controls_Manager::TEXT,
536 'default' => __( 'Write your message here...', 'wpfnl' ),
537 'label_block' => true,
538 'condition' => [
539 'message' => 'yes',
540 ],
541 ]
542 );
543 $this->add_control(
544 'is_required_message',
545 [
546 'label' => __('Mark Message As Required', 'wpfnl'),
547 'type' => Controls_Manager::SWITCHER,
548 'label_on' => __( 'Yes', 'wpfnl' ),
549 'label_off' => __( 'No', 'wpfnl' ),
550 'return_value' => 'yes',
551 'default' => '',
552 'condition' => [
553 'message' => 'yes',
554 ],
555 'separator' => 'after'
556 ]
557 );
558
559
560 //-----acceptance checkbox-----
561 $this->add_control(
562 'acceptance_checkbox',
563 [
564 'label' => __('Acceptance Checkbox', 'wpfnl'),
565 'type' => Controls_Manager::SWITCHER,
566 'label_on' => __( 'Show', 'wpfnl' ),
567 'label_off' => __( 'Hide', 'wpfnl' ),
568 'return_value' => 'yes',
569 'default' => '',
570 ]
571 );
572 $this->add_control(
573 'acceptance_checkbox_text',
574 [
575 'label' => __('Acceptance Text', 'wpfnl'),
576 'type' => \Elementor\Controls_Manager::WYSIWYG,
577 'label_block' => true,
578 'default' => __('I have read and agree the Terms & Condition.', 'wpfnl'),
579 'condition' => [
580 'acceptance_checkbox' => 'yes',
581 ],
582 ]
583 );
584 $this->add_control(
585 'is_required_acceptance',
586 [
587 'label' => __('Mark Acceptance As Required', 'wpfnl'),
588 'type' => Controls_Manager::SWITCHER,
589 'label_on' => __( 'Yes', 'wpfnl' ),
590 'label_off' => __( 'No', 'wpfnl' ),
591 'return_value' => 'yes',
592 'default' => '',
593 'condition' => [
594 'acceptance_checkbox' => 'yes',
595 ],
596 'separator' => 'after'
597 ]
598 );
599
600 $this->add_control(
601 'input_fields_icon',
602 [
603 'label' => __('Show Input Field Icon(s)', 'wpfnl'),
604 'type' => Controls_Manager::SWITCHER,
605 'label_on' => __( 'Show', 'wpfnl' ),
606 'label_off' => __( 'Hide', 'wpfnl' ),
607 'return_value' => 'yes',
608 'default' => 'yes',
609 ]
610 );
611
612 $this->add_control(
613 'field_label',
614 [
615 'label' => __('Show Field Label(s)', 'wpfnl'),
616 'type' => Controls_Manager::SWITCHER,
617 'label_on' => __( 'Show', 'wpfnl' ),
618 'label_off' => __( 'Hide', 'wpfnl' ),
619 'return_value' => 'yes',
620 'default' => '',
621 'separator' => 'before',
622 ]
623 );
624
625 $this->add_control(
626 'required_mark',
627 [
628 'label' => __('Show Required Mark', 'wpfnl'),
629 'type' => Controls_Manager::SWITCHER,
630 'label_on' => __( 'Show', 'wpfnl' ),
631 'label_off' => __( 'Hide', 'wpfnl' ),
632 'return_value' => 'yes',
633 'default' => 'yes',
634 'condition' => [
635 'field_label' => 'yes',
636 ],
637 ]
638 );
639
640 $this->end_controls_section();
641 }
642
643
644 /**
645 * Register Button Controls.
646 *
647 * @since 1.0.0
648 * @access protected
649 */
650 protected function register_form_button_controls(){
651 $this->start_controls_section(
652 'wpfnl_optin_form_button_controls', array(
653 'label' => __('Submit Button', 'wpfnl'),
654 )
655 );
656
657 $this->add_control(
658 'btn_text',
659 [
660 'label' => __('Text', 'wpfnl'),
661 'type' => Controls_Manager::TEXT,
662 'default' => __('Submit', 'wpfnl'),
663 'placeholder' => __('Submit', 'wpfnl'),
664 ]
665 );
666
667 $this->add_responsive_control(
668 'btn_align',
669 [
670 'label' => __('Alignment', 'wpfnl'),
671 'type' => Controls_Manager::CHOOSE,
672 'options' => [
673 'left' => [
674 'title' => __('Left', 'wpfnl'),
675 'icon' => 'fa fa-align-left',
676 ],
677 'center' => [
678 'title' => __('Center', 'wpfnl'),
679 'icon' => 'fa fa-align-center',
680 ],
681 'right' => [
682 'title' => __('Right', 'wpfnl'),
683 'icon' => 'fa fa-align-right',
684 ],
685 'justify' => [
686 'title' => __('Justified', 'wpfnl'),
687 'icon' => 'fa fa-align-justify',
688 ],
689 ],
690 'default' => '',
691 'condition' => [
692 'optin_form_layout[value]!' => 'form-style1',
693 ],
694 ]
695 );
696
697 $this->add_control(
698 'btn_icon',
699 [
700 'label' => __('Icon', 'wpfnl'),
701 'type' => Controls_Manager::ICONS,
702 'fa4compatibility' => 'icon',
703 ]
704 );
705
706 $this->add_control(
707 'btn_icon_align',
708 [
709 'label' => __('Icon Position', 'wpfnl'),
710 'type' => Controls_Manager::SELECT,
711 'default' => 'left',
712 'options' => [
713 'left' => __('Before Text', 'wpfnl'),
714 'right' => __('After Text', 'wpfnl'),
715 ],
716 'condition' => [
717 'btn_icon[value]!' => '',
718 ],
719 ]
720 );
721
722 $this->add_control(
723 'btn_icon_indent',
724 [
725 'label' => __('Icon Spacing', 'wpfnl'),
726 'type' => Controls_Manager::SLIDER,
727 'range' => [
728 'px' => [
729 'max' => 50,
730 ],
731 ],
732 'condition' => [
733 'btn_icon!' => '',
734 ],
735 'selectors' => [
736 '{{WRAPPER}} .elementor-button .elementor-align-icon-right' => 'margin-left: {{SIZE}}{{UNIT}};',
737 '{{WRAPPER}} .elementor-button .elementor-align-icon-left' => 'margin-right: {{SIZE}}{{UNIT}};',
738 ],
739 ]
740 );
741
742
743
744 $this->end_controls_section();
745 }
746
747
748 /**
749 * Register Click to Expand Button Controls.
750 *
751 * @since 1.0.0
752 * @access protected
753 */
754 protected function register_clickto_expand_button_controls(){
755 $this->start_controls_section(
756 'wpfnl_optin_clickto_expand_control', array(
757 'label' => __('Click to Expand Button', 'wpfnl'),
758 'condition' => [
759 'optin_form_type' => 'clickto-expand-optin',
760 ],
761 )
762 );
763
764 $this->add_control(
765 'clickto_expand_btn_text',
766 [
767 'label' => __('Text', 'wpfnl'),
768 'type' => Controls_Manager::TEXT,
769 'default' => __('Click to Expand', 'wpfnl'),
770 'placeholder' => __('Write the button title', 'wpfnl'),
771 ]
772 );
773
774 $this->add_responsive_control(
775 'clickto_expand_btn_align',
776 [
777 'label' => __('Alignment', 'wpfnl'),
778 'type' => Controls_Manager::CHOOSE,
779 'options' => [
780 'left' => [
781 'title' => __('Left', 'wpfnl'),
782 'icon' => 'fa fa-align-left',
783 ],
784 'center' => [
785 'title' => __('Center', 'wpfnl'),
786 'icon' => 'fa fa-align-center',
787 ],
788 'right' => [
789 'title' => __('Right', 'wpfnl'),
790 'icon' => 'fa fa-align-right',
791 ],
792 'justify' => [
793 'title' => __('Justified', 'wpfnl'),
794 'icon' => 'fa fa-align-justify',
795 ],
796 ],
797 'default' => '',
798 ]
799 );
800
801 $this->add_control(
802 'clickto_expand_btn_icon',
803 [
804 'label' => __('Icon', 'wpfnl'),
805 'type' => Controls_Manager::ICONS,
806 'fa4compatibility' => 'icon',
807 ]
808 );
809
810 $this->add_control(
811 'clickto_expand_btn_icon_align',
812 [
813 'label' => __('Icon Position', 'wpfnl'),
814 'type' => Controls_Manager::SELECT,
815 'default' => 'left',
816 'options' => [
817 'left' => __('Before Text', 'wpfnl'),
818 'right' => __('After Text', 'wpfnl'),
819 ],
820 'condition' => [
821 'clickto_expand_btn_icon[value]!' => '',
822 ],
823 ]
824 );
825
826 $this->add_control(
827 'clickto_expand_btn_icon_indent',
828 [
829 'label' => __('Icon Spacing', 'wpfnl'),
830 'type' => Controls_Manager::SLIDER,
831 'range' => [
832 'px' => [
833 'max' => 50,
834 ],
835 ],
836 'condition' => [
837 'clickto_expand_btn_icon!' => '',
838 ],
839 'selectors' => [
840 '{{WRAPPER}} .clickto-expand-btn.elementor-button .elementor-align-icon-right' => 'margin-left: {{SIZE}}{{UNIT}};',
841 '{{WRAPPER}} .clickto-expand-btn.elementor-button .elementor-align-icon-left' => 'margin-right: {{SIZE}}{{UNIT}};',
842 ],
843 ]
844 );
845
846
847 $this->end_controls_section();
848 }
849
850
851 /**
852 * Register Action After Submit Controls.
853 *
854 * @since 1.0.0
855 * @access protected
856 */
857 protected function register_action_after_submit_controls(){
858 $this->start_controls_section(
859 'wpfnl_action_after_submit_controls', array(
860 'label' => __('Action After Submission', 'wpfnl'),
861 )
862 );
863
864 $this->add_control(
865 'admin_email',
866 [
867 'label' => __('Admin Email', 'wpfnl'),
868 'type' => Controls_Manager::TEXT,
869 'label_block' => true,
870 'default' => wp_get_current_user()->user_email,
871 'separator' => 'before',
872 ]
873 );
874
875 $this->add_control(
876 'admin_email_subject',
877 [
878 'label' => __('Admin Email Subject', 'wpfnl'),
879 'type' => Controls_Manager::TEXT,
880 'default' => 'New Form Submission',
881 'label_block' => true,
882 ]
883 );
884
885 $this->add_control(
886 'notification_text',
887 [
888 'label' => __( 'Notification Text', 'wpfnl' ),
889 'type' => Controls_Manager::TEXTAREA,
890 'rows' => 5,
891 'default' => 'Thank you! Your form was submitted successfully!',
892 'placeholder' => __( 'Type notification texts here', 'wpfnl' ),
893 ]
894 );
895
896 $this->add_control(
897 'post_action',
898 [
899 'label' => __( 'Other action', 'wpfnl' ),
900 'type' => \Elementor\Controls_Manager::SELECT,
901 'default' => 'notification',
902 'options' => [
903 'notification' => __( 'None', 'wpfnl' ),
904 'redirect_to' => __( 'Redirect to url', 'wpfnl' ),
905 'next_step' => __( 'Next Step', 'wpfnl' ),
906 ],
907 ]
908 );
909
910 $this->add_control(
911 'redirect_url',
912 [
913 'label' => __( 'Redirect url', 'wpfnl' ),
914 'type' => Controls_Manager::URL,
915 'placeholder' => __( 'https://your-link.com', 'wpfnl' ),
916 'show_external' => true,
917 'default' => [
918 'url' => '',
919 'is_external' => false,
920 'nofollow' => true,
921 ],
922 'condition' => [
923 'post_action' => 'redirect_to',
924 ]
925 ]
926 );
927
928 $this->add_control(
929 'data_to_checkout',
930 [
931 'label' => __('Carry data to the Next Form', 'wpfnl'),
932 'type' => Controls_Manager::SWITCHER,
933 'label_on' => __( 'Yes', 'wpfnl' ),
934 'label_off' => __( 'No', 'wpfnl' ),
935 'return_value' => 'yes',
936 'default' => '',
937 ]
938 );
939
940 $this->add_control(
941 'allow_registration',
942 [
943 'label' => __('Register User As Subscriber', 'wpfnl'),
944 'type' => Controls_Manager::SWITCHER,
945 'label_on' => __( 'Show', 'wpfnl' ),
946 'label_off' => __( 'Hide', 'wpfnl' ),
947 'return_value' => 'yes',
948 'default' => '',
949 ]
950 );
951 $this->add_control(
952 'allow_user_permission',
953 [
954 'label' => __('Registration Permission', 'wpfnl'),
955 'type' => Controls_Manager::SWITCHER,
956 'label_on' => __( 'Show', 'wpfnl' ),
957 'label_off' => __( 'Hide', 'wpfnl' ),
958 'return_value' => 'yes',
959 'default' => '',
960 'condition' => [
961 'allow_registration' => 'yes',
962 ],
963 ]
964 );
965 $this->add_control(
966 'allow_user_registration_permission_text',
967 [
968 'label' => __('Registration Permission Text', 'wpfnl'),
969 'type' => \Elementor\Controls_Manager::WYSIWYG,
970 'label_block' => true,
971 'default' => __('I agree to be registered as a subscriber.', 'wpfnl'),
972 'condition' => [
973 'allow_user_permission' => 'yes',
974 'allow_registration' => 'yes',
975 ],
976 ]
977 );
978
979
980 $this->end_controls_section();
981 }
982
983 /**
984 * Register Label Style Controls.
985 *
986 * @since 1.0.0
987 * @access protected
988 */
989 protected function register_form_style_controls(){
990 $this->start_controls_section(
991 'form_section_style',
992 [
993 'label' => __('Form', 'wpfnl'),
994 'tab' => Controls_Manager::TAB_STYLE,
995 ]
996 );
997
998 $this->add_control(
999 'row_spacing',
1000 [
1001 'label' => __('Row Spacing', 'wpfnl'),
1002 'type' => Controls_Manager::SLIDER,
1003 'range' => [
1004 'px' => [
1005 'max' => 50,
1006 ],
1007 ],
1008 'selectors' => [
1009 '{{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group:not(:last-child)' => 'margin-bottom: {{SIZE}}{{UNIT}};',
1010 ],
1011 ]
1012 );
1013
1014 //--------start label style------
1015 $this->add_control(
1016 'label_style',
1017 [
1018 'label' => __('Label', 'wpfnl'),
1019 'type' => Controls_Manager::HEADING,
1020 'label_block' => true,
1021 'separator' => 'before',
1022 ]
1023 );
1024 $this->add_group_control(
1025 Group_Control_Typography::get_type(),
1026 [
1027 'name' => 'label_typography',
1028 'label' => 'Typography',
1029 'selector' => '{{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group > label',
1030 ]
1031 );
1032
1033 $this->add_control(
1034 'label_color',
1035 [
1036 'label' => __('Color', 'wpfnl'),
1037 'type' => Controls_Manager::COLOR,
1038 'default' => '',
1039 'selectors' => [
1040 '{{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group > label' => 'color: {{VALUE}};',
1041 ],
1042 ]
1043 );
1044
1045 $this->add_control(
1046 'label_spacing',
1047 [
1048 'label' => __('Spacing', 'wpfnl'),
1049 'type' => Controls_Manager::SLIDER,
1050 'range' => [
1051 'px' => [
1052 'max' => 50,
1053 ],
1054 ],
1055 'selectors' => [
1056 '{{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group:not(.acceptance-checkbox):not(.user-registration-checkbox) > label' => 'margin-bottom: {{SIZE}}{{UNIT}};',
1057 ],
1058 ]
1059 );
1060 //--------end label style------
1061
1062
1063 $this->add_control(
1064 'tnc_link_color',
1065 [
1066 'label' => __('Link Color', 'wpfnl'),
1067 'type' => Controls_Manager::COLOR,
1068 'default' => '',
1069 'selectors' => [
1070 '{{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group > label a' => 'color: {{VALUE}};',
1071 ],
1072 ]
1073 );
1074
1075 $this->add_control(
1076 'checkbox_active_color',
1077 [
1078 'label' => __('Checkbox Active Color', 'wpfnl'),
1079 'type' => Controls_Manager::COLOR,
1080 'default' => '',
1081 'selectors' => [
1082 '{{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group input[type="checkbox"]:checked + label .check-box' => 'background-color: {{VALUE}}; border-color: {{VALUE}};',
1083 ],
1084 ]
1085 );
1086
1087 $this->add_control(
1088 'checkbox_size',
1089 [
1090 'label' => __('Checkbox Size', 'wpfnl'),
1091 'type' => Controls_Manager::SLIDER,
1092 'range' => [
1093 'px' => [
1094 'min' => 18,
1095 'max' => 40,
1096 ],
1097 ],
1098 'selectors' => [
1099 '{{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group > label .check-box' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};',
1100 ],
1101 ]
1102 );
1103
1104 $this->add_control(
1105 'checkbox_spacing',
1106 [
1107 'label' => __('Checkbox Spacing', 'wpfnl'),
1108 'type' => Controls_Manager::SLIDER,
1109 'range' => [
1110 'px' => [
1111 'max' => 60,
1112 ],
1113 ],
1114 'selectors' => [
1115 '{{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group.acceptance-checkbox > label,
1116 {{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group.user-registration-checkbox > label' => 'padding-left: {{SIZE}}{{UNIT}};',
1117 ],
1118 ]
1119 );
1120 //--------end terms and condition style------
1121
1122 $this->end_controls_section();
1123 }
1124
1125
1126 /**
1127 * Register Input field Style Controls.
1128 *
1129 * @since 1.0.0
1130 * @access protected
1131 */
1132 protected function register_input_fields_style_controls(){
1133 $this->start_controls_section(
1134 'inputs_section_style',
1135 [
1136 'label' => __('Input Fields', 'wpfnl'),
1137 'tab' => Controls_Manager::TAB_STYLE,
1138 ]
1139 );
1140
1141 $this->add_group_control(
1142 Group_Control_Typography::get_type(),
1143 [
1144 'name' => 'inputs_typography',
1145 'label' => 'Typography',
1146 'selector' => '{{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group input[type=text],
1147 {{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group input[type=email],
1148 {{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group textarea',
1149 ]
1150 );
1151
1152 $this->add_control(
1153 'input_text_color',
1154 [
1155 'label' => __('Text Color', 'wpfnl'),
1156 'type' => Controls_Manager::COLOR,
1157 'default' => '',
1158 'selectors' => [
1159 '{{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group input[type=text],
1160 {{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group input[type=email],
1161 {{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group textarea' => 'color: {{VALUE}};',
1162 ],
1163 ]
1164 );
1165
1166 $this->add_control(
1167 'input_bg_color',
1168 [
1169 'label' => __('Background Color', 'wpfnl'),
1170 'type' => Controls_Manager::COLOR,
1171 'default' => '',
1172 'selectors' => [
1173 '{{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group input[type=text],
1174 {{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group input[type=email],
1175 {{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group textarea' => 'background-color: {{VALUE}};',
1176 ],
1177 ]
1178 );
1179
1180 $this->add_group_control(
1181 Group_Control_Box_Shadow::get_type(),
1182 [
1183 'name' => 'input_box_shadow',
1184 'selector' => '{{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group input[type=text],
1185 {{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group input[type=email],
1186 {{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group textarea',
1187 ]
1188 );
1189
1190 $this->add_group_control(
1191 Group_Control_Border::get_type(),
1192 [
1193 'name' => 'input_border',
1194 'label' => __('Border', 'wpfnl'),
1195 'placeholder' => '1px',
1196 'default' => '1px',
1197 'selector' => '{{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group input[type=text],
1198 {{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group input[type=email],
1199 {{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group textarea',
1200 'separator' => 'before',
1201 ]
1202 );
1203
1204 $this->add_responsive_control(
1205 'input_border_radius',
1206 [
1207 'label' => __('Border Radius', 'wpfnl'),
1208 'type' => Controls_Manager::DIMENSIONS,
1209 'size_units' => ['px', '%'],
1210 'selectors' => [
1211 '{{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group input[type=text],
1212 {{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group input[type=email],
1213 {{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group textarea' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1214 ],
1215 ]
1216 );
1217
1218 $this->add_responsive_control(
1219 'input_padding',
1220 [
1221 'label' => __('Padding', 'wpfnl'),
1222 'type' => Controls_Manager::DIMENSIONS,
1223 'size_units' => ['px', 'em', '%'],
1224 'selectors' => [
1225 '{{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group input[type=text],
1226 {{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group input[type=email],
1227 {{WRAPPER}} .wpfnl-optin-form .wpfnl-optin-form-group textarea' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1228 ],
1229 'separator' => 'before',
1230 ]
1231 );
1232
1233 $this->end_controls_section();
1234 }
1235
1236
1237 /**
1238 * Register Button Style Controls.
1239 *
1240 * @since 1.0.0
1241 * @access protected
1242 */
1243 protected function register_button_style_controls(){
1244 $this->start_controls_section(
1245 'btn_section_style',
1246 [
1247 'label' => __('Submit Button', 'wpfnl'),
1248 'tab' => Controls_Manager::TAB_STYLE,
1249 ]
1250 );
1251
1252 $this->add_group_control(
1253 Group_Control_Typography::get_type(),
1254 [
1255 'name' => 'btn_typography',
1256 'label' => 'Typography',
1257 'selector' => '{{WRAPPER}} button.elementor-button',
1258 ]
1259 );
1260
1261 $this->start_controls_tabs('btn_color_style');
1262 $this->start_controls_tab(
1263 'tab_button_normal',
1264 [
1265 'label' => __('Normal', 'wpfnl'),
1266 ]
1267 );
1268
1269 $this->add_control(
1270 'btn_text_color',
1271 [
1272 'label' => __('Text Color', 'wpfnl'),
1273 'type' => Controls_Manager::COLOR,
1274 'default' => '',
1275 'selectors' => [
1276 '{{WRAPPER}} button.elementor-button, {{WRAPPER}} .elementor-button' => 'color: {{VALUE}}!important;',
1277 ],
1278 ]
1279 );
1280
1281 $this->add_control(
1282 'btn_bg_color',
1283 [
1284 'label' => __('Background Color', 'wpfnl'),
1285 'type' => Controls_Manager::COLOR,
1286 'default' => '',
1287 'selectors' => [
1288 '{{WRAPPER}} button.elementor-button, {{WRAPPER}} .elementor-button' => 'background-color: {{VALUE}}!important;',
1289 ],
1290 ]
1291 );
1292
1293 $this->add_group_control(
1294 Group_Control_Box_Shadow::get_type(),
1295 [
1296 'name' => 'btn_box_shadow',
1297 'selector' => '{{WRAPPER}} button.elementor-button',
1298 ]
1299 );
1300
1301 $this->end_controls_tab();
1302 //---end normal style----
1303
1304 $this->start_controls_tab(
1305 'tab_button_hover',
1306 [
1307 'label' => __('Hover', 'wpfnl'),
1308 ]
1309 );
1310
1311 $this->add_control(
1312 'btn_hover_text_color',
1313 [
1314 'label' => __('Text Color', 'wpfnl'),
1315 'type' => Controls_Manager::COLOR,
1316 'default' => '',
1317 'selectors' => [
1318 '{{WRAPPER}} button.elementor-button:hover, {{WRAPPER}} .elementor-button:hover' => 'color: {{VALUE}}!important;',
1319 ],
1320 ]
1321 );
1322
1323 $this->add_control(
1324 'btn_hover_bg_color',
1325 [
1326 'label' => __('Background Color', 'wpfnl'),
1327 'type' => Controls_Manager::COLOR,
1328 'default' => '',
1329 'selectors' => [
1330 '{{WRAPPER}} button.elementor-button:hover, {{WRAPPER}} .elementor-button:hover' => 'background-color: {{VALUE}}!important;',
1331 ],
1332 ]
1333 );
1334
1335 $this->add_group_control(
1336 Group_Control_Box_Shadow::get_type(),
1337 [
1338 'name' => 'btn_hover_box_shadow',
1339 'selector' => '{{WRAPPER}} button.elementor-button:hover',
1340 ]
1341 );
1342
1343 $this->end_controls_tab();
1344 //---end hover style----
1345
1346 $this->end_controls_tabs();
1347 //---end butotn color style tab----
1348
1349 $this->add_group_control(
1350 Group_Control_Border::get_type(),
1351 [
1352 'name' => 'btn_border',
1353 'label' => __('Border', 'wpfnl'),
1354 'placeholder' => '1px',
1355 'default' => '1px',
1356 'selector' => '{{WRAPPER}} button.elementor-button',
1357 'separator' => 'before',
1358 ]
1359 );
1360
1361 $this->add_responsive_control(
1362 'border_radius',
1363 [
1364 'label' => __('Border Radius', 'wpfnl'),
1365 'type' => Controls_Manager::DIMENSIONS,
1366 'size_units' => ['px', '%'],
1367 'selectors' => [
1368 '{{WRAPPER}} button.elementor-button, {{WRAPPER}} .elementor-button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1369 ],
1370 ]
1371 );
1372
1373 $this->add_responsive_control(
1374 'btn_padding',
1375 [
1376 'label' => __('Padding', 'wpfnl'),
1377 'type' => Controls_Manager::DIMENSIONS,
1378 'size_units' => ['px', 'em', '%'],
1379 'selectors' => [
1380 '{{WRAPPER}} button.elementor-button, {{WRAPPER}} .elementor-button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1381 ],
1382 'separator' => 'before',
1383 ]
1384 );
1385
1386 $this->end_controls_section();
1387 }
1388
1389
1390 /**
1391 * Register click to expand Button Style Controls.
1392 *
1393 * @since 1.0.0
1394 * @access protected
1395 */
1396 protected function register_clickto_expand_style_controls(){
1397 $this->start_controls_section(
1398 'clickto_expand_btn_section_style',
1399 [
1400 'label' => __('Click to Expand Button', 'wpfnl'),
1401 'tab' => Controls_Manager::TAB_STYLE,
1402 'condition' => [
1403 'optin_form_type' => 'clickto-expand-optin',
1404 ],
1405 ]
1406 );
1407
1408 $this->add_group_control(
1409 Group_Control_Typography::get_type(),
1410 [
1411 'name' => 'clickto_expand_btn_typography',
1412 'label' => 'Typography',
1413 'selector' => '{{WRAPPER}} button.elementor-button.clickto-expand-btn',
1414 ]
1415 );
1416
1417 $this->start_controls_tabs('clickto_expand_btn_color_style');
1418 $this->start_controls_tab(
1419 'clickto_expand_tab_button_normal',
1420 [
1421 'label' => __('Normal', 'wpfnl'),
1422 ]
1423 );
1424
1425 $this->add_control(
1426 'clickto_expand_btn_text_color',
1427 [
1428 'label' => __('Text Color', 'wpfnl'),
1429 'type' => Controls_Manager::COLOR,
1430 'default' => '',
1431 'selectors' => [
1432 '{{WRAPPER}} button.elementor-button.clickto-expand-btn,
1433 {{WRAPPER}} .elementor-button.clickto-expand-btn' => 'color: {{VALUE}}!important;',
1434 ],
1435 ]
1436 );
1437
1438 $this->add_control(
1439 'clickto_expand_btn_bg_color',
1440 [
1441 'label' => __('Background Color', 'wpfnl'),
1442 'type' => Controls_Manager::COLOR,
1443 'default' => '',
1444 'selectors' => [
1445 '{{WRAPPER}} button.elementor-button.clickto-expand-btn,
1446 {{WRAPPER}} .elementor-button.clickto-expand-btn' => 'background-color: {{VALUE}}!important;',
1447 ],
1448 ]
1449 );
1450
1451 $this->add_group_control(
1452 Group_Control_Box_Shadow::get_type(),
1453 [
1454 'name' => 'clickto_expand_btn_box_shadow',
1455 'selector' => '{{WRAPPER}} button.elementor-button.clickto-expand-btn',
1456 ]
1457 );
1458
1459 $this->end_controls_tab();
1460 //---end normal style----
1461
1462 $this->start_controls_tab(
1463 'clickto_expand_tab_button_hover',
1464 [
1465 'label' => __('Hover', 'wpfnl'),
1466 ]
1467 );
1468
1469 $this->add_control(
1470 'clickto_expand_btn_hover_text_color',
1471 [
1472 'label' => __('Text Color', 'wpfnl'),
1473 'type' => Controls_Manager::COLOR,
1474 'default' => '',
1475 'selectors' => [
1476 '{{WRAPPER}} button.elementor-button.clickto-expand-btn:hover,
1477 {{WRAPPER}} .elementor-button.clickto-expand-btn:hover' => 'color: {{VALUE}}!important;',
1478 ],
1479 ]
1480 );
1481
1482 $this->add_control(
1483 'clickto_expand_btn_hover_bg_color',
1484 [
1485 'label' => __('Background Color', 'wpfnl'),
1486 'type' => Controls_Manager::COLOR,
1487 'default' => '',
1488 'selectors' => [
1489 '{{WRAPPER}} button.elementor-button.clickto-expand-btn:hover,
1490 {{WRAPPER}} .elementor-button.clickto-expand-btn:hover' => 'background-color: {{VALUE}}!important;',
1491 ],
1492 ]
1493 );
1494
1495 $this->add_group_control(
1496 Group_Control_Box_Shadow::get_type(),
1497 [
1498 'name' => 'clickto_expand_btn_hover_box_shadow',
1499 'selector' => '{{WRAPPER}} button.elementor-button.clickto-expand-btn:hover',
1500 ]
1501 );
1502
1503 $this->end_controls_tab();
1504 //---end hover style----
1505
1506 $this->end_controls_tabs();
1507 //---end butotn color style tab----
1508
1509 $this->add_group_control(
1510 Group_Control_Border::get_type(),
1511 [
1512 'name' => 'clickto_expand_btn_border',
1513 'label' => __('Border', 'wpfnl'),
1514 'placeholder' => '1px',
1515 'default' => '1px',
1516 'selector' => '{{WRAPPER}} button.elementor-button.clickto-expand-btn',
1517 'separator' => 'before',
1518 ]
1519 );
1520
1521 $this->add_responsive_control(
1522 'clickto_expand_border_radius',
1523 [
1524 'label' => __('Border Radius', 'wpfnl'),
1525 'type' => Controls_Manager::DIMENSIONS,
1526 'size_units' => ['px', '%'],
1527 'selectors' => [
1528 '{{WRAPPER}} button.elementor-button.clickto-expand-btn,
1529 {{WRAPPER}} .elementor-button.clickto-expand-btn' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1530 ],
1531 ]
1532 );
1533
1534 $this->add_responsive_control(
1535 'clickto_expand_btn_padding',
1536 [
1537 'label' => __('Padding', 'wpfnl'),
1538 'type' => Controls_Manager::DIMENSIONS,
1539 'size_units' => ['px', 'em', '%'],
1540 'selectors' => [
1541 '{{WRAPPER}} button.elementor-button.clickto-expand-btn,
1542 {{WRAPPER}} .elementor-button.clickto-expand-btn' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1543 ],
1544 'separator' => 'before',
1545 ]
1546 );
1547
1548 $this->end_controls_section();
1549 }
1550
1551
1552 /**
1553 * Get wrapper classes
1554 *
1555 * @return array
1556 */
1557 protected function get_wrapper_classes() {
1558 $settings = $this->get_settings_for_display();
1559
1560 if( 'clickto-expand-optin' == $settings['optin_form_type'] ) {
1561 return array( 'wpfnl', 'wpfnl-optin-form', 'wpfnl-elementor-optin-form-wrapper', 'clickto-expand-optin');
1562
1563 }else {
1564 return array( 'wpfnl', 'wpfnl-optin-form', 'wpfnl-elementor-optin-form-wrapper');
1565
1566 }
1567 }
1568
1569
1570 /**
1571 * Render the widget output on the frontend.
1572 *
1573 * Written in PHP and used to generate the final HTML.
1574 *
1575 * @since 2.1.8
1576 *
1577 * @access protected
1578 */
1579 protected function render()
1580 {
1581 $settings = $this->get_settings_for_display();
1582 $classes = $this->get_wrapper_classes();
1583 $this->add_render_attribute(
1584 [
1585 'wrapper' => [
1586 'class' => [
1587 'elementor-form-fields-wrapper',
1588 ],
1589 ],
1590 ]
1591 );
1592
1593 $this->add_render_attribute('button', 'class', 'btn-optin elementor-button');
1594 $this->add_render_attribute('click-to-expand-button', 'class', 'elementor-button');
1595
1596 $recaptcha_setting = Wpfnl_functions::get_recaptcha_settings();
1597 $is_recaptch = isset($recaptcha_setting['enable_recaptcha']) ? $recaptcha_setting['enable_recaptcha'] : '';
1598 $site_key = isset($recaptcha_setting['recaptcha_site_key']) ? $recaptcha_setting['recaptcha_site_key'] : '';
1599 $site_secret_key = isset($recaptcha_setting['recaptcha_site_secret']) ? $recaptcha_setting['recaptcha_site_secret'] : '';
1600 $token_input = '';
1601 $recaptch_script = '';
1602 $is_recaptch_input = '';
1603 $token_secret_key = '';
1604 if('on' == $is_recaptch && '' != $site_key && '' != $site_secret_key){
1605 $is_recaptch_input = '<input type="hidden" id="wpf-is-recapcha" name="wpf-is-recapcha" value="'.$is_recaptch.'"/>';
1606 $token_input = '<input type="hidden" id="wpf-optin-g-token" name="wpf-optin-g-token" />';
1607 $token_secret_key = '<input type="hidden" id="wpf-optin-g-secret-key" name="wpf-optin-g-secret-key" value="'.$site_secret_key.'" />';
1608 $recaptch_script = '<script src="https://www.google.com/recaptcha/api.js?render='.$site_key.'"></script>';
1609 }
1610 ?>
1611 <style>
1612 <?php if( '' == $settings['input_fields_icon'] ){ ?>
1613 .wpfnl-optin-form .wpfnl-optin-form-group input[type=text],
1614 .wpfnl-optin-form .wpfnl-optin-form-group input[type=email] {
1615 padding-right: 14px;
1616 }
1617 <?php } ?>
1618 </style>
1619 <?php echo $recaptch_script; ?>
1620
1621 <?php
1622 if( 'clickto-expand-optin' == $settings['optin_form_type'] ) {
1623 ?>
1624 <div class="wpfnl-optin-clickto-expand align-<?php echo $settings['clickto_expand_btn_align'] ?>">
1625 <button class="btn-default clickto-expand-btn elementor-button" type="button" <?php echo $this->get_render_attribute_string('click-to-expand-button'); ?> >
1626 <?php $this->render_clickto_expand_text(); ?>
1627 </button>
1628 </div>
1629 <?php
1630 }
1631 ?>
1632
1633 <div class="<?php echo esc_attr( implode( ' ', $classes ) ); ?>" <?php $this->print_render_attribute_string( 'wrapper' ); ?> >
1634 <form method="post" <?php $this->print_render_attribute_string( 'form' ); ?>>
1635 <input type="hidden" name="post_id" value="<?php echo get_the_ID(); ?>" />
1636 <input type="hidden" name="form_id" value="<?php echo esc_attr( $this->get_id() ); ?>"/>
1637 <?php
1638 echo $is_recaptch_input;
1639 echo $token_input;
1640 echo $token_secret_key;
1641 ?>
1642 <div class="wpfnl-optin-form-wrapper <?php echo $settings['optin_form_layout']; ?>" >
1643 <?php if( 'yes' == $settings['first_name'] ){ ?>
1644 <div class="wpfnl-optin-form-group first-name">
1645
1646 <?php if( 'yes' == $settings['field_label'] ){ ?>
1647 <label for="wpfnl-first-name">
1648 <?php
1649 echo $settings['first_name_label'] ? $settings['first_name_label'] : __('First Name','wpfnl');
1650
1651 if( 'yes' == $settings['required_mark'] && 'yes' == $settings['is_required_name'] ){ ?>
1652 <span class="required-mark">*</span>
1653 <?php } ?>
1654 </label>
1655 <?php } ?>
1656
1657 <span class="input-wrapper">
1658 <?php if( 'yes' == $settings['input_fields_icon'] ){ ?>
1659 <span class="field-icon">
1660 <img src="<?php echo WPFNL_DIR_URL.'/public/assets/images/user-icon.svg'; ?>" alt="icon">
1661 </span>
1662 <?php }
1663 $f_name_placeholder = isset($settings['first_name_placeholder']) ? $settings['first_name_placeholder'] : '';
1664 ?>
1665 <input type="text" name="first_name" class="wpfnl-first-name" id="wpfnl-first-name" placeholder="<?php echo $f_name_placeholder; ?>" <?php echo 'yes' == $settings['is_required_name'] ? 'required' : ''; ?>/>
1666 </span>
1667
1668 </div>
1669 <?php } ?>
1670
1671 <?php if( 'yes' == $settings['last_name'] ){ ?>
1672 <div class="wpfnl-optin-form-group last-name">
1673
1674 <?php if( 'yes' == $settings['field_label'] ){ ?>
1675 <label for="wpfnl-last-name">
1676 <?php
1677 echo $settings['last_name_label'] ? $settings['last_name_label'] : __('Last Name','wpfnl');
1678
1679 if( 'yes' == $settings['required_mark'] && 'yes' == $settings['is_required_last_name'] ){ ?>
1680 <span class="required-mark">*</span>
1681 <?php } ?>
1682 </label>
1683 <?php } ?>
1684
1685 <span class="input-wrapper">
1686 <?php if( 'yes' == $settings['input_fields_icon'] ){ ?>
1687 <span class="field-icon">
1688 <img src="<?php echo WPFNL_DIR_URL.'/public/assets/images/user-icon.svg'; ?>" alt="icon">
1689 </span>
1690 <?php }
1691 $l_name_placeholder = isset($settings['last_name_placeholder']) ? $settings['last_name_placeholder'] : '';
1692 ?>
1693 <input type="text" name="last_name" class="wpfnl-last-name" id="wpfnl-last-name" placeholder="<?php echo $l_name_placeholder;?>" <?php echo 'yes' == $settings['is_required_last_name'] ? 'required' : ''; ?>/>
1694 </span>
1695 </div>
1696 <?php } ?>
1697
1698 <div class="wpfnl-optin-form-group email">
1699 <?php if( 'yes' == $settings['field_label'] ){ ?>
1700 <label for="wpfnl-email">
1701 <?php
1702 echo $settings['email_label'] ? $settings['email_label'] : __('Email','wpfnl');
1703
1704 if( 'yes' == $settings['required_mark'] ){ ?>
1705 <span class="required-mark">*</span>
1706 <?php } ?>
1707 </label>
1708 <?php } ?>
1709 <span class="input-wrapper">
1710 <?php if( 'yes' == $settings['input_fields_icon'] ){ ?>
1711 <span class="field-icon">
1712 <img src="<?php echo WPFNL_DIR_URL.'/public/assets/images/email-open-icon.svg'; ?>" alt="icon">
1713 </span>
1714 <?php }
1715 $email_placeholder = isset($settings['email_placeholder']) ? $settings['email_placeholder'] : '';
1716 ?>
1717 <input type="email" name="email" class="wpfnl-email" id="wpfnl-email" placeholder="<?php echo $email_placeholder; ?>" pattern="[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$" required />
1718 </span>
1719 </div>
1720
1721 <?php if( 'yes' == $settings['phone'] ){ ?>
1722 <div class="wpfnl-optin-form-group phone">
1723
1724 <?php if( 'yes' == $settings['field_label'] ){ ?>
1725 <label for="wpfnl-phone">
1726 <?php
1727 echo $settings['phone_label'] ? $settings['phone_label'] : __('Phone','wpfnl');
1728
1729 if( 'yes' == $settings['required_mark'] && 'yes' == $settings['is_required_phone'] ){ ?>
1730 <span class="required-mark">*</span>
1731 <?php } ?>
1732 </label>
1733 <?php } ?>
1734
1735 <span class="input-wrapper">
1736 <?php if( 'yes' == $settings['input_fields_icon'] ){ ?>
1737 <span class="field-icon">
1738 <img src="<?php echo WPFNL_DIR_URL.'/public/assets/images/phone.svg'; ?>" alt="icon">
1739 </span>
1740 <?php }
1741 $phone_placeholder = isset($settings['phone_placeholder']) ? $settings['phone_placeholder'] : '';
1742 ?>
1743 <input type="text" name="phone" class="wpfnl-phone" id="wpfnl-phone" placeholder="<?php echo $phone_placeholder; ?>" <?php echo 'yes' == $settings['is_required_phone'] ? 'required' : ''; ?>/>
1744 </span>
1745 </div>
1746 <?php } ?>
1747
1748 <?php if( 'yes' == $settings['website_url'] ){ ?>
1749 <div class="wpfnl-optin-form-group website-url">
1750
1751 <?php if( 'yes' == $settings['field_label'] ){ ?>
1752 <label for="wpfnl-web-url">
1753 <?php
1754 echo $settings['website_url_label'] ? $settings['website_url_label'] : __('Website Url','wpfnl');
1755
1756 if( 'yes' == $settings['required_mark'] && 'yes' == $settings['is_required_website_url'] ){ ?>
1757 <span class="required-mark">*</span>
1758 <?php } ?>
1759 </label>
1760 <?php } ?>
1761
1762 <span class="input-wrapper">
1763 <?php if( 'yes' == $settings['input_fields_icon'] ){ ?>
1764 <span class="field-icon">
1765 <img src="<?php echo WPFNL_DIR_URL.'/public/assets/images/web-url.svg'; ?>" alt="icon">
1766 </span>
1767 <?php }
1768 $weburl_placeholder = isset($settings['website_url_placeholder']) ? $settings['website_url_placeholder'] : '';
1769 ?>
1770 <input type="text" name="web-url" class="wpfnl-web-url" id="wpfnl-web-url" pattern="https?://.+" size="30" placeholder="<?php echo $weburl_placeholder; ?>" <?php echo 'yes' == $settings['is_required_website_url'] ? 'required' : ''; ?>/>
1771 </span>
1772 </div>
1773 <?php } ?>
1774
1775 <?php if( 'yes' == $settings['message'] ){ ?>
1776 <div class="wpfnl-optin-form-group message">
1777
1778 <?php if( 'yes' == $settings['field_label'] ){ ?>
1779 <label for="wpfnl-message">
1780 <?php
1781 echo $settings['message_label'] ? $settings['message_label'] : __('Message','wpfnl');
1782
1783 if( 'yes' == $settings['required_mark'] && 'yes' == $settings['is_required_message'] ){ ?>
1784 <span class="required-mark">*</span>
1785 <?php } ?>
1786 </label>
1787 <?php }
1788
1789 $message_placeholder = isset($settings['message_placeholder']) ? $settings['message_placeholder'] : '';
1790 ?>
1791
1792 <span class="input-wrapper">
1793 <textarea name="message" class="wpfnl-message" id="wpfnl-message" cols="30" rows="3" placeholder="<?php echo $message_placeholder; ?>" <?php echo 'yes' == $settings['is_required_message'] ? 'required' : ''; ?> ></textarea>
1794 </span>
1795 </div>
1796 <?php } ?>
1797
1798 <?php
1799 if( 'yes' == $settings['acceptance_checkbox'] ){
1800 ?>
1801 <div class="wpfnl-optin-form-group acceptance-checkbox">
1802 <input type="checkbox" name="acceptance_checkbox" class="wpfnl-acceptance_checkbox" id="wpfnl-acceptance_checkbox-<?php echo esc_attr( $this->get_id() ); ?>" <?php echo 'yes' == $settings['is_required_acceptance'] ? 'required' : ''; ?> />
1803 <label for="wpfnl-acceptance_checkbox-<?php echo esc_attr( $this->get_id() ); ?>">
1804 <span class="check-box"></span>
1805 <?php
1806 echo $settings['acceptance_checkbox_text'] ? $settings['acceptance_checkbox_text'] : '';
1807
1808 if( 'yes' == $settings['required_mark'] && 'yes' == $settings['is_required_acceptance'] ){
1809 echo '<span class="required-mark">*</span>';
1810 }
1811 ?>
1812 </label>
1813 </div>
1814 <?php
1815 }
1816 ?>
1817
1818 <?php
1819 if( 'yes' == $settings['allow_registration']){
1820 ?>
1821 <input type="hidden" name="optin_allow_registration" value="<?php echo esc_attr( 'yes' ); ?>"/>
1822 <?php
1823 if('yes' == $settings['allow_user_permission']){
1824 ?>
1825 <div class="wpfnl-optin-form-group user-registration-checkbox">
1826 <input type="checkbox" name="user_registration_checkbox" class="wpfnl-registration_checkbox" id="wpfnl-registration_checkbox-<?php echo esc_attr( $this->get_id() ); ?>" required/>
1827 <label for="wpfnl-registration_checkbox-<?php echo esc_attr( $this->get_id() ); ?>">
1828 <span class="check-box"></span>
1829 <?php
1830 echo $settings['allow_user_registration_permission_text'] ? $settings['allow_user_registration_permission_text'] : '';
1831 ?>
1832 <span class="required-mark">*</span>
1833 </label>
1834 </div>
1835 <?php
1836 }
1837 }
1838 ?>
1839 <?php
1840 if( 'yes' == $settings['data_to_checkout']){
1841 ?>
1842 <input type="hidden" name="data_to_checkout" value="<?php echo esc_attr( 'yes' ); ?>"/>
1843 <?php
1844 }
1845 ?>
1846
1847 <div class="wpfnl-optin-form-group submit align-<?php echo $settings['btn_align'] ?>">
1848 <button type="submit" <?php echo $this->get_render_attribute_string('button'); ?>>
1849 <?php $this->render_text(); ?>
1850 <span class="wpfnl-loader"></span>
1851 </button>
1852 </div>
1853 </div>
1854 </form>
1855
1856 <?php
1857 if('on' == $is_recaptch && '' != $site_key && '' != $site_secret_key){?>
1858 <script>
1859 grecaptcha.ready(function() {
1860 grecaptcha.execute('<?php echo $site_key ?>', {action: 'homepage'}).then(function(token) {
1861 document.getElementById("wpf-optin-g-token").value = token;
1862 });
1863 });
1864 </script>
1865 <?php
1866 }
1867 ?>
1868 <div class="response"></div>
1869 </div>
1870 <?php
1871 }
1872
1873
1874
1875 /**
1876 * Render button text.
1877 *
1878 * @since 1.0.0
1879 * @access protected
1880 */
1881 protected function render_text()
1882 {
1883 $settings = $this->get_settings();
1884 $migrated = isset($settings['__fa4_migrated']['btn_icon']);
1885 $is_new = empty($settings['icon']) && Icons_Manager::is_migration_allowed();
1886
1887 if (!$is_new && empty($settings['btn_icon_align'])) {
1888 $settings['btn_icon_align'] = $this->get_settings('btn_icon_align');
1889 }
1890
1891 $this->add_render_attribute([
1892 'content-wrapper' => [
1893 'class' => 'elementor-button-content-wrapper',
1894 ],
1895 'icon-align' => [
1896 'class' => [
1897 'elementor-button-icon',
1898 'elementor-align-icon-' . $settings['btn_icon_align'],
1899 ],
1900 ],
1901 'text' => [
1902 'class' => 'elementor-button-text',
1903 ],
1904 ]);
1905
1906 // $this->add_render_attribute('content-wrapper', 'class', 'elementor-button-content-wrapper');
1907 //$this->add_render_attribute('text', 'class', 'elementor-button-text');
1908
1909 $this->add_inline_editing_attributes('text', 'none');
1910 ?>
1911 <span <?php echo $this->get_render_attribute_string('content-wrapper'); ?>>
1912
1913 <?php if (!empty($settings['icon']) || !empty($settings['btn_icon']['value'])) : ?>
1914 <span <?php echo $this->get_render_attribute_string('icon-align'); ?>>
1915 <?php if ($is_new || $migrated) :
1916 Icons_Manager::render_icon($settings['btn_icon'], ['aria-hidden' => 'true']);
1917 else : ?>
1918 <i class="<?php echo esc_attr($settings['icon']); ?>" aria-hidden="true"></i>
1919 <?php endif; ?>
1920 </span>
1921 <?php endif; ?>
1922
1923 <span <?php echo $this->get_render_attribute_string('text'); ?>><?php echo $settings['btn_text']; ?></span>
1924 </span>
1925 <?php
1926 }
1927
1928 /**
1929 * Render click to expand button text.
1930 *
1931 * @since 1.0.0
1932 * @access protected
1933 */
1934 protected function render_clickto_expand_text()
1935 {
1936 $settings = $this->get_settings();
1937 $migrated = isset($settings['__fa4_migrated']['clickto_expand_btn_icon']);
1938 $is_new = empty($settings['icon']) && Icons_Manager::is_migration_allowed();
1939
1940 if (!$is_new && empty($settings['clickto_expand_btn_icon_align'])) {
1941 $settings['clickto_expand_btn_icon_align'] = $this->get_settings('clickto_expand_btn_icon_align');
1942 }
1943
1944 $this->add_render_attribute([
1945 'expand-btn-content-wrapper' => [
1946 'class' => 'elementor-button-content-wrapper',
1947 ],
1948 'expand-btn-icon-align' => [
1949 'class' => [
1950 'elementor-button-icon',
1951 'elementor-align-icon-' . $settings['clickto_expand_btn_icon_align'],
1952 ],
1953 ],
1954 'expand-btn-text' => [
1955 'class' => 'elementor-button-text',
1956 ],
1957 ]);
1958
1959 //$this->add_render_attribute('text', 'class', 'elementor-button-text');
1960
1961 $this->add_inline_editing_attributes('text', 'none');
1962 ?>
1963 <span <?php echo $this->get_render_attribute_string('expand-btn-content-wrapper'); ?>>
1964
1965 <?php if (!empty($settings['icon']) || !empty($settings['clickto_expand_btn_icon']['value'])) : ?>
1966 <span <?php echo $this->get_render_attribute_string('expand-btn-icon-align'); ?>>
1967 <?php if ($is_new || $migrated) :
1968 Icons_Manager::render_icon($settings['clickto_expand_btn_icon'], ['aria-hidden' => 'true']);
1969 else : ?>
1970 <i class="<?php echo esc_attr($settings['icon']); ?>" aria-hidden="true"></i>
1971 <?php endif; ?>
1972 </span>
1973 <?php endif; ?>
1974
1975 <span <?php echo $this->get_render_attribute_string('expand-btn-text'); ?>><?php echo $settings['clickto_expand_btn_text']; ?></span>
1976 </span>
1977 <?php
1978 }
1979
1980
1981 }
1982