PluginProbe
Master Addons for Elementor – Elementor Addons, Widgets, Mega Menu Builder, Popup Builder, Widget Builder & Template Kits / trunk
Master Addons for Elementor – Elementor Addons, Widgets, Mega Menu Builder, Popup Builder, Widget Builder & Template Kits vtrunk
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 / forms / wpforms / wpforms.php

wpforms.php in Master Addons for Elementor – Elementor Addons, Widgets, Mega Menu Builder, Popup Builder, Widget Builder & Template Kits trunk, at addons/forms/wpforms/wpforms.php

1,348 lines 37.7 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 // Elementor Classes
6 use \Elementor\Controls_Stack;
7 use Elementor\Controls_Manager;
8 use Elementor\Utils;
9 use Elementor\Group_Control_Image_Size;
10 use Elementor\Group_Control_Background;
11 use Elementor\Group_Control_Box_Shadow;
12 use Elementor\Group_Control_Border;
13 use Elementor\Group_Control_Typography;
14 use \Elementor\Core\Kits\Documents\Tabs\Global_Typography;
15 use \Elementor\Core\Kits\Documents\Tabs\Global_Colors;
16 use MasterAddons\Inc\Classes\Helper;
17 use MasterAddons\Inc\Admin\Config;
18 use MasterAddons\Inc\Classes\Base\Master_Widget;
19
20 if (!defined('ABSPATH')) exit; // If this file is called directly, abort.
21
22 class WP_Forms extends Master_Widget
23 {
24 use \MasterAddons\Inc\Traits\Widget_Notice;
25 use \MasterAddons\Inc\Traits\Widget_Assets_Trait;
26
27 public function get_name()
28 {
29 return 'ma-wpforms';
30 }
31 public function get_title()
32 {
33 return esc_html__('WPForms', 'master-addons' );
34 }
35
36 public function get_icon()
37 {
38 return 'jltma-icon ' . Config::get_addon_icon('wpforms');
39 }
40
41
42 protected function register_controls()
43 {
44
45 /*-----------------------------------------------------------------------------------*/
46 /* Content Tab
47 /*-----------------------------------------------------------------------------------*/
48
49 $this->start_controls_section(
50 'section_info_box',
51 [
52 'label' => __('WPForms', 'master-addons' ),
53 ]
54 );
55
56 $this->add_control(
57 'contact_form_list',
58 [
59 'label' => esc_html__('Contact Form', 'master-addons' ),
60 'type' => Controls_Manager::SELECT,
61 'label_block' => true,
62 'options' => Helper::jltma_el_get_wpforms_forms(),
63 'default' => '0',
64 ]
65 );
66
67 $this->add_control(
68 'custom_title_description',
69 [
70 'label' => __('Custom Title & Description', 'master-addons' ),
71 'type' => Controls_Manager::SWITCHER,
72 'label_on' => __('Yes', 'master-addons' ),
73 'label_off' => __('No', 'master-addons' ),
74 'return_value' => 'yes',
75 'default' => 'no',
76 ]
77 );
78
79 $this->add_control(
80 'form_title',
81 [
82 'label' => __('Title', 'master-addons' ),
83 'type' => Controls_Manager::SWITCHER,
84 'label_on' => __('Show', 'master-addons' ),
85 'label_off' => __('Hide', 'master-addons' ),
86 'return_value' => 'yes',
87 'condition' => [
88 'custom_title_description!' => 'yes',
89 ],
90 'default' => 'no',
91 ]
92 );
93
94 $this->add_control(
95 'form_description',
96 [
97 'label' => __('Description', 'master-addons' ),
98 'type' => Controls_Manager::SWITCHER,
99 'label_on' => __('Show', 'master-addons' ),
100 'label_off' => __('Hide', 'master-addons' ),
101 'return_value' => 'yes',
102 'condition' => [
103 'custom_title_description!' => 'yes',
104 ],
105 'default' => 'no',
106 ]
107 );
108
109 $this->add_control(
110 'form_title_custom',
111 [
112 'label' => esc_html__('Title', 'master-addons' ),
113 'type' => Controls_Manager::TEXT,
114 'label_block' => true,
115 'default' => '',
116 'condition' => [
117 'custom_title_description' => 'yes',
118 ],
119 ]
120 );
121
122 $this->add_control(
123 'form_description_custom',
124 [
125 'label' => esc_html__('Description', 'master-addons' ),
126 'type' => Controls_Manager::TEXTAREA,
127 'default' => '',
128 'condition' => [
129 'custom_title_description' => 'yes',
130 ],
131 ]
132 );
133
134 $this->add_control(
135 'labels_switch',
136 [
137 'label' => __('Labels', 'master-addons' ),
138 'type' => Controls_Manager::SWITCHER,
139 'default' => 'yes',
140 'label_on' => __('Show', 'master-addons' ),
141 'label_off' => __('Hide', 'master-addons' ),
142 'return_value' => 'yes',
143 'prefix_class' => 'jltma-wpforms-labels-',
144 ]
145 );
146
147 $this->add_control(
148 'placeholder_switch',
149 [
150 'label' => __('Placeholder', 'master-addons' ),
151 'type' => Controls_Manager::SWITCHER,
152 'default' => 'yes',
153 'label_on' => __('Show', 'master-addons' ),
154 'label_off' => __('Hide', 'master-addons' ),
155 'return_value' => 'yes',
156 ]
157 );
158
159 $this->end_controls_section();
160
161 /**
162 * Content Tab: Errors
163 * -------------------------------------------------
164 */
165 $this->start_controls_section(
166 'section_errors',
167 [
168 'label' => __('Errors', 'master-addons' ),
169 ]
170 );
171
172 $this->add_control(
173 'error_messages',
174 [
175 'label' => __('Error Messages', 'master-addons' ),
176 'type' => Controls_Manager::SELECT,
177 'default' => 'show',
178 'options' => [
179 'show' => __('Show', 'master-addons' ),
180 'hide' => __('Hide', 'master-addons' ),
181 ],
182 'selectors_dictionary' => [
183 'show' => 'block',
184 'hide' => 'none',
185 ],
186 'selectors' => [
187 '{{WRAPPER}} .jltma-wpforms label.wpforms-error' => 'display: {{VALUE}} !important;',
188 ],
189 ]
190 );
191
192 $this->end_controls_section();
193
194 /*-----------------------------------------------------------------------------------*/
195 /* STYLE TAB
196 /*-----------------------------------------------------------------------------------*/
197
198 /**
199 * Style Tab: Form Title & Description
200 * -------------------------------------------------
201 */
202
203 $this->start_controls_section(
204 'ma_wpform_section_style',
205 [
206 'label' => esc_html__('Design Layout', 'master-addons' ),
207 'tab' => Controls_Manager::TAB_STYLE,
208 ]
209 );
210
211 // Define default free options - Pro version overrides via filter
212 $layout_style_options = apply_filters('master_addons/addons/wpforms/layout_style', [
213 '1' => __('Style One', 'master-addons'),
214 '2' => __('Style Two', 'master-addons'),
215 '3' => __('Style Three', 'master-addons'),
216 '4' => __('Style Four', 'master-addons'),
217 'wpf-pro-1' => __('Style Five (Pro)', 'master-addons'),
218 'wpf-pro-2' => __('Style Six (Pro)', 'master-addons'),
219 'wpf-pro-3' => __('Style Seven (Pro)', 'master-addons'),
220 'wpf-pro-4' => __('Style Eight (Pro)', 'master-addons'),
221 'wpf-pro-5' => __('Style Nine (Pro)', 'master-addons'),
222 'wpf-pro-6' => __('Style Ten (Pro)', 'master-addons'),
223 'wpf-pro-7' => __('Style Eleven (Pro)', 'master-addons'),
224 ]);
225
226 $this->add_control(
227 'ma_wpform_layout_style',
228 [
229 'label' => __('Design Variations', 'master-addons'),
230 'type' => Controls_Manager::SELECT,
231 'default' => '1',
232 'options' => $layout_style_options,
233 'description' => Helper::upgrade_to_pro('10+ more Variations on'),
234 ]
235 );
236
237 $this->end_controls_section();
238
239 $this->start_controls_section(
240 'section_form_title_style',
241 [
242 'label' => __('Title & Description', 'master-addons' ),
243 'tab' => Controls_Manager::TAB_STYLE,
244 ]
245 );
246
247 $this->add_responsive_control(
248 'heading_alignment',
249 [
250 'label' => __('Alignment', 'master-addons' ),
251 'type' => Controls_Manager::CHOOSE,
252 'options' => Helper::jltma_content_alignment(),
253 'default' => '',
254 'selectors' => [
255 '{{WRAPPER}} .wpforms-head-container, {{WRAPPER}} .jltma-wpforms-heading' => 'text-align: {{VALUE}};',
256 ],
257 ]
258 );
259
260 $this->add_control(
261 'title_heading',
262 [
263 'label' => __('Title', 'master-addons' ),
264 'type' => Controls_Manager::HEADING,
265 'separator' => 'before',
266 ]
267 );
268
269 $this->add_control(
270 'form_title_text_color',
271 [
272 'label' => __('Text Color', 'master-addons' ),
273 'type' => Controls_Manager::COLOR,
274 'default' => '',
275 'selectors' => [
276 '{{WRAPPER}} .jltma-contact-form-title, {{WRAPPER}} .wpforms-title' => 'color: {{VALUE}}',
277 ],
278 ]
279 );
280
281 $this->add_group_control(
282 Group_Control_Typography::get_type(),
283 [
284 'name' => 'form_title_typography',
285 'label' => __('Typography', 'master-addons' ),
286 'selector' => '{{WRAPPER}} .jltma-contact-form-title, {{WRAPPER}} .wpforms-title',
287 ]
288 );
289
290 $this->add_responsive_control(
291 'form_title_margin',
292 [
293 'label' => __('Margin', 'master-addons' ),
294 'type' => Controls_Manager::DIMENSIONS,
295 'size_units' => ['px', 'em', '%'],
296 'allowed_dimensions' => 'vertical',
297 'placeholder' => [
298 'top' => '',
299 'right' => 'auto',
300 'bottom' => '',
301 'left' => 'auto',
302 ],
303 'selectors' => [
304 '{{WRAPPER}} .jltma-contact-form-title, {{WRAPPER}} .wpforms-title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
305 ],
306 ]
307 );
308
309 $this->add_control(
310 'description_heading',
311 [
312 'label' => __('Description', 'master-addons' ),
313 'type' => Controls_Manager::HEADING,
314 'separator' => 'before',
315 ]
316 );
317
318 $this->add_control(
319 'form_description_text_color',
320 [
321 'label' => __('Text Color', 'master-addons' ),
322 'type' => Controls_Manager::COLOR,
323 'default' => '',
324 'selectors' => [
325 '{{WRAPPER}} .jltma-contact-form-description, {{WRAPPER}} .wpforms-description' => 'color: {{VALUE}}',
326 ],
327 ]
328 );
329
330 $this->add_group_control(
331 Group_Control_Typography::get_type(),
332 [
333 'name' => 'form_description_typography',
334 'label' => __('Typography', 'master-addons' ),
335 'global' => [
336 'default' => Global_Typography::TYPOGRAPHY_ACCENT,
337 ],
338 'selector' => '{{WRAPPER}} .jltma-contact-form-description, {{WRAPPER}} .wpforms-description',
339 ]
340 );
341
342 $this->add_responsive_control(
343 'form_description_margin',
344 [
345 'label' => __('Margin', 'master-addons' ),
346 'type' => Controls_Manager::DIMENSIONS,
347 'size_units' => ['px', 'em', '%'],
348 'allowed_dimensions' => 'vertical',
349 'placeholder' => [
350 'top' => '',
351 'right' => 'auto',
352 'bottom' => '',
353 'left' => 'auto',
354 ],
355 'selectors' => [
356 '{{WRAPPER}} .jltma-contact-form-description, {{WRAPPER}} .wpforms-description' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
357 ],
358 ]
359 );
360
361 $this->end_controls_section();
362
363 /**
364 * Style Tab: Labels
365 * -------------------------------------------------
366 */
367 $this->start_controls_section(
368 'section_label_style',
369 [
370 'label' => __('Labels', 'master-addons' ),
371 'tab' => Controls_Manager::TAB_STYLE,
372 ]
373 );
374
375 $this->add_control(
376 'text_color_label',
377 [
378 'label' => __('Text Color', 'master-addons' ),
379 'type' => Controls_Manager::COLOR,
380 'selectors' => [
381 '{{WRAPPER}} .jltma-wpforms .wpforms-field label' => 'color: {{VALUE}}',
382 ],
383 ]
384 );
385
386 $this->add_group_control(
387 Group_Control_Typography::get_type(),
388 [
389 'name' => 'typography_label',
390 'label' => __('Typography', 'master-addons' ),
391 'global' => [
392 'default' => Global_Typography::TYPOGRAPHY_ACCENT,
393 ],
394 'selector' => '{{WRAPPER}} .jltma-wpforms .wpforms-field label',
395 ]
396 );
397
398 $this->end_controls_section();
399
400 /**
401 * Style Tab: Input & Textarea
402 * -------------------------------------------------
403 */
404 $this->start_controls_section(
405 'section_fields_style',
406 [
407 'label' => __('Input & Textarea', 'master-addons' ),
408 'tab' => Controls_Manager::TAB_STYLE,
409 ]
410 );
411
412 $this->add_responsive_control(
413 'input_alignment',
414 [
415 'label' => __('Alignment', 'master-addons' ),
416 'type' => Controls_Manager::CHOOSE,
417 'options' => Helper::jltma_content_alignment(),
418 'default' => '',
419 'selectors' => [
420 '{{WRAPPER}} .jltma-wpforms .wpforms-field input:not([type=radio]):not([type=checkbox]):not([type=submit]):not([type=button]):not([type=image]):not([type=file]), {{WRAPPER}} .jltma-wpforms .wpforms-field textarea, {{WRAPPER}} .jltma-wpforms .wpforms-field select' => 'text-align: {{VALUE}};',
421 ],
422 ]
423 );
424
425 $this->start_controls_tabs('tabs_fields_style');
426
427 $this->start_controls_tab(
428 'tab_fields_normal',
429 [
430 'label' => __('Normal', 'master-addons' ),
431 ]
432 );
433
434 $this->add_control(
435 'field_bg_color',
436 [
437 'label' => __('Background Color', 'master-addons' ),
438 'type' => Controls_Manager::COLOR,
439 'default' => '',
440 'selectors' => [
441 '{{WRAPPER}} .jltma-wpforms .wpforms-field input:not([type=radio]):not([type=checkbox]):not([type=submit]):not([type=button]):not([type=image]):not([type=file]), {{WRAPPER}} .jltma-wpforms .wpforms-field textarea, {{WRAPPER}} .jltma-wpforms .wpforms-field select' => 'background-color: {{VALUE}}',
442 ],
443 ]
444 );
445
446 $this->add_control(
447 'field_text_color',
448 [
449 'label' => __('Text Color', 'master-addons' ),
450 'type' => Controls_Manager::COLOR,
451 'default' => '',
452 'selectors' => [
453 '{{WRAPPER}} .jltma-wpforms .wpforms-field input:not([type=radio]):not([type=checkbox]):not([type=submit]):not([type=button]):not([type=image]):not([type=file]), {{WRAPPER}} .jltma-wpforms .wpforms-field textarea, {{WRAPPER}} .jltma-wpforms .wpforms-field select' => 'color: {{VALUE}}',
454 ],
455 ]
456 );
457
458 $this->add_group_control(
459 Group_Control_Border::get_type(),
460 [
461 'name' => 'field_border',
462 'label' => __('Border', 'master-addons' ),
463 'placeholder' => '1px',
464 'default' => '1px',
465 'selector' => '{{WRAPPER}} .jltma-wpforms .wpforms-field input:not([type=radio]):not([type=checkbox]):not([type=submit]):not([type=button]):not([type=image]):not([type=file]), {{WRAPPER}} .jltma-wpforms .wpforms-field textarea, {{WRAPPER}} .jltma-wpforms .wpforms-field select',
466 'separator' => 'before',
467 ]
468 );
469
470 $this->add_control(
471 'field_radius',
472 [
473 'label' => __('Border Radius', 'master-addons' ),
474 'type' => Controls_Manager::DIMENSIONS,
475 'size_units' => ['px', 'em', '%'],
476 'selectors' => [
477 '{{WRAPPER}} .jltma-wpforms .wpforms-field input:not([type=radio]):not([type=checkbox]):not([type=submit]):not([type=button]):not([type=image]):not([type=file]), {{WRAPPER}} .jltma-wpforms .wpforms-field textarea, {{WRAPPER}} .jltma-wpforms .wpforms-field select' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
478 ],
479 ]
480 );
481
482 $this->add_responsive_control(
483 'text_indent',
484 [
485 'label' => __('Text Indent', 'master-addons' ),
486 'type' => Controls_Manager::SLIDER,
487 'range' => [
488 'px' => [
489 'min' => 0,
490 'max' => 60,
491 'step' => 1,
492 ],
493 '%' => [
494 'min' => 0,
495 'max' => 30,
496 'step' => 1,
497 ],
498 ],
499 'size_units' => ['px', 'em', '%'],
500 'selectors' => [
501 '{{WRAPPER}} .jltma-wpforms .wpforms-field input:not([type=radio]):not([type=checkbox]):not([type=submit]):not([type=button]):not([type=image]):not([type=file]), {{WRAPPER}} .jltma-wpforms .wpforms-field textarea, {{WRAPPER}} .jltma-wpforms .wpforms-field select' => 'text-indent: {{SIZE}}{{UNIT}}',
502 ],
503 'separator' => 'before',
504 ]
505 );
506
507 $this->add_responsive_control(
508 'input_width',
509 [
510 'label' => __('Input Width', 'master-addons' ),
511 'type' => Controls_Manager::SLIDER,
512 'range' => [
513 'px' => [
514 'min' => 0,
515 'max' => 1200,
516 'step' => 1,
517 ],
518 ],
519 'size_units' => ['px', 'em', '%'],
520 'selectors' => [
521 '{{WRAPPER}} .jltma-wpforms .wpforms-field input:not([type=radio]):not([type=checkbox]):not([type=submit]):not([type=button]):not([type=image]):not([type=file]), {{WRAPPER}} .jltma-wpforms .wpforms-field select' => 'width: {{SIZE}}{{UNIT}}',
522 ],
523 ]
524 );
525
526 $this->add_responsive_control(
527 'input_height',
528 [
529 'label' => __('Input Height', 'master-addons' ),
530 'type' => Controls_Manager::SLIDER,
531 'range' => [
532 'px' => [
533 'min' => 0,
534 'max' => 80,
535 'step' => 1,
536 ],
537 ],
538 'size_units' => ['px', 'em', '%'],
539 'selectors' => [
540 '{{WRAPPER}} .jltma-wpforms .wpforms-field input:not([type=radio]):not([type=checkbox]):not([type=submit]):not([type=button]):not([type=image]):not([type=file]), {{WRAPPER}} .jltma-wpforms .wpforms-field select' => 'height: {{SIZE}}{{UNIT}}',
541 ],
542 ]
543 );
544
545 $this->add_responsive_control(
546 'textarea_width',
547 [
548 'label' => __('Textarea Width', 'master-addons' ),
549 'type' => Controls_Manager::SLIDER,
550 'range' => [
551 'px' => [
552 'min' => 0,
553 'max' => 1200,
554 'step' => 1,
555 ],
556 ],
557 'size_units' => ['px', 'em', '%'],
558 'selectors' => [
559 '{{WRAPPER}} .jltma-wpforms .wpforms-field textarea' => 'width: {{SIZE}}{{UNIT}}',
560 ],
561 ]
562 );
563
564 $this->add_responsive_control(
565 'textarea_height',
566 [
567 'label' => __('Textarea Height', 'master-addons' ),
568 'type' => Controls_Manager::SLIDER,
569 'range' => [
570 'px' => [
571 'min' => 0,
572 'max' => 400,
573 'step' => 1,
574 ],
575 ],
576 'size_units' => ['px', 'em', '%'],
577 'selectors' => [
578 '{{WRAPPER}} .jltma-wpforms .wpforms-field textarea' => 'height: {{SIZE}}{{UNIT}}',
579 ],
580 ]
581 );
582
583 $this->add_responsive_control(
584 'field_padding',
585 [
586 'label' => __('Padding', 'master-addons' ),
587 'type' => Controls_Manager::DIMENSIONS,
588 'size_units' => ['px', 'em', '%'],
589 'selectors' => [
590 '{{WRAPPER}} .jltma-wpforms .wpforms-field input:not([type=radio]):not([type=checkbox]):not([type=submit]):not([type=button]):not([type=image]):not([type=file]), {{WRAPPER}} .jltma-wpforms .wpforms-field textarea, {{WRAPPER}} .jltma-wpforms .wpforms-field select' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
591 ],
592 'separator' => 'before',
593 ]
594 );
595
596 $this->add_responsive_control(
597 'field_spacing',
598 [
599 'label' => __('Spacing', 'master-addons' ),
600 'type' => Controls_Manager::SLIDER,
601 'range' => [
602 'px' => [
603 'min' => 0,
604 'max' => 100,
605 'step' => 1,
606 ],
607 ],
608 'size_units' => ['px', 'em', '%'],
609 'selectors' => [
610 '{{WRAPPER}} .jltma-wpforms .wpforms-field' => 'margin-bottom: {{SIZE}}{{UNIT}}',
611 ],
612 ]
613 );
614
615 $this->add_group_control(
616 Group_Control_Typography::get_type(),
617 [
618 'name' => 'field_typography',
619 'label' => __('Typography', 'master-addons' ),
620 'global' => [
621 'default' => Global_Typography::TYPOGRAPHY_ACCENT,
622 ],
623 'selector' => '{{WRAPPER}} .jltma-wpforms .wpforms-field input:not([type=radio]):not([type=checkbox]):not([type=submit]):not([type=button]):not([type=image]):not([type=file]), {{WRAPPER}} .jltma-wpforms .wpforms-field textarea, {{WRAPPER}} .jltma-wpforms .wpforms-field select',
624 'separator' => 'before',
625 ]
626 );
627
628 $this->add_group_control(
629 Group_Control_Box_Shadow::get_type(),
630 [
631 'name' => 'field_box_shadow',
632 'selector' => '{{WRAPPER}} .jltma-wpforms .wpforms-field input:not([type=radio]):not([type=checkbox]):not([type=submit]):not([type=button]):not([type=image]):not([type=file]), {{WRAPPER}} .jltma-wpforms .wpforms-field textarea, {{WRAPPER}} .jltma-wpforms .wpforms-field select',
633 'separator' => 'before',
634 ]
635 );
636
637 $this->end_controls_tab();
638
639 $this->start_controls_tab(
640 'tab_fields_focus',
641 [
642 'label' => __('Focus', 'master-addons' ),
643 ]
644 );
645
646 $this->add_group_control(
647 Group_Control_Border::get_type(),
648 [
649 'name' => 'focus_input_border',
650 'label' => __('Border', 'master-addons' ),
651 'placeholder' => '1px',
652 'default' => '1px',
653 'selector' => '{{WRAPPER}} .jltma-wpforms .wpforms-field input:focus, {{WRAPPER}} .jltma-wpforms .wpforms-field textarea:focus',
654 ]
655 );
656
657 $this->add_group_control(
658 Group_Control_Box_Shadow::get_type(),
659 [
660 'name' => 'focus_box_shadow',
661 'selector' => '{{WRAPPER}} .jltma-wpforms .wpforms-field input:focus, {{WRAPPER}} .jltma-wpforms .wpforms-field textarea:focus',
662 'separator' => 'before',
663 ]
664 );
665
666 $this->end_controls_tab();
667
668 $this->end_controls_tabs();
669
670 $this->end_controls_section();
671
672 /**
673 * Style Tab: Field Description
674 * -------------------------------------------------
675 */
676 $this->start_controls_section(
677 'section_field_description_style',
678 [
679 'label' => __('Field Description', 'master-addons' ),
680 'tab' => Controls_Manager::TAB_STYLE,
681 ]
682 );
683
684 $this->add_control(
685 'field_description_text_color',
686 [
687 'label' => __('Text Color', 'master-addons' ),
688 'type' => Controls_Manager::COLOR,
689 'selectors' => [
690 '{{WRAPPER}} .jltma-wpforms .wpforms-field .wpforms-field-description, {{WRAPPER}} .jltma-wpforms .wpforms-field .wpforms-field-sublabel' => 'color: {{VALUE}}',
691 ],
692 ]
693 );
694
695 $this->add_group_control(
696 Group_Control_Typography::get_type(),
697 [
698 'name' => 'field_description_typography',
699 'label' => __('Typography', 'master-addons' ),
700 'selector' => '{{WRAPPER}} .jltma-wpforms .wpforms-field .wpforms-field-description, {{WRAPPER}} .jltma-wpforms .wpforms-field .wpforms-field-sublabel',
701 ]
702 );
703
704 $this->add_responsive_control(
705 'field_description_spacing',
706 [
707 'label' => __('Spacing', 'master-addons' ),
708 'type' => Controls_Manager::SLIDER,
709 'range' => [
710 'px' => [
711 'min' => 0,
712 'max' => 100,
713 'step' => 1,
714 ],
715 ],
716 'size_units' => ['px', 'em', '%'],
717 'selectors' => [
718 '{{WRAPPER}} .jltma-wpforms .wpforms-field .wpforms-field-description, {{WRAPPER}} .jltma-wpforms .wpforms-field .wpforms-field-sublabel' => 'padding-top: {{SIZE}}{{UNIT}}',
719 ],
720 ]
721 );
722
723 $this->end_controls_section();
724
725 /**
726 * Style Tab: Placeholder
727 * -------------------------------------------------
728 */
729 $this->start_controls_section(
730 'section_placeholder_style',
731 [
732 'label' => __('Placeholder', 'master-addons' ),
733 'tab' => Controls_Manager::TAB_STYLE,
734 'condition' => [
735 'placeholder_switch' => 'yes',
736 ],
737 ]
738 );
739
740 $this->add_control(
741 'text_color_placeholder',
742 [
743 'label' => __('Text Color', 'master-addons' ),
744 'type' => Controls_Manager::COLOR,
745 'selectors' => [
746 '{{WRAPPER}} .jltma-wpforms .wpforms-field input::-webkit-input-placeholder, {{WRAPPER}} .jltma-wpforms .wpforms-field textarea::-webkit-input-placeholder' => 'color: {{VALUE}}',
747 ],
748 'condition' => [
749 'placeholder_switch' => 'yes',
750 ],
751 ]
752 );
753
754 $this->end_controls_section();
755
756 /**
757 * Style Tab: Radio & Checkbox
758 * -------------------------------------------------
759 */
760 $this->start_controls_section(
761 'section_radio_checkbox_style',
762 [
763 'label' => __('Radio & Checkbox', 'master-addons' ),
764 'tab' => Controls_Manager::TAB_STYLE,
765 ]
766 );
767
768 $this->add_control(
769 'custom_radio_checkbox',
770 [
771 'label' => __('Custom Styles', 'master-addons' ),
772 'type' => Controls_Manager::SWITCHER,
773 'label_on' => __('Yes', 'master-addons' ),
774 'label_off' => __('No', 'master-addons' ),
775 'return_value' => 'yes',
776 ]
777 );
778
779 $this->add_responsive_control(
780 'radio_checkbox_size',
781 [
782 'label' => __('Size', 'master-addons' ),
783 'type' => Controls_Manager::SLIDER,
784 'default' => [
785 'size' => '15',
786 'unit' => 'px'
787 ],
788 'range' => [
789 'px' => [
790 'min' => 0,
791 'max' => 80,
792 'step' => 1,
793 ],
794 ],
795 'size_units' => ['px', 'em', '%'],
796 'selectors' => [
797 '{{WRAPPER}} .jltma-custom-radio-checkbox input[type="checkbox"], {{WRAPPER}} .jltma-custom-radio-checkbox input[type="radio"]' => 'width: {{SIZE}}{{UNIT}} !important; height: {{SIZE}}{{UNIT}}',
798 ],
799 'condition' => [
800 'custom_radio_checkbox' => 'yes',
801 ],
802 ]
803 );
804
805 $this->start_controls_tabs('tabs_radio_checkbox_style');
806
807 $this->start_controls_tab(
808 'radio_checkbox_normal',
809 [
810 'label' => __('Normal', 'master-addons' ),
811 'condition' => [
812 'custom_radio_checkbox' => 'yes',
813 ],
814 ]
815 );
816
817 $this->add_control(
818 'radio_checkbox_color',
819 [
820 'label' => __('Color', 'master-addons' ),
821 'type' => Controls_Manager::COLOR,
822 'default' => '',
823 'selectors' => [
824 '{{WRAPPER}} .jltma-custom-radio-checkbox input[type="checkbox"], {{WRAPPER}} .jltma-custom-radio-checkbox input[type="radio"]' => 'background: {{VALUE}}',
825 ],
826 'condition' => [
827 'custom_radio_checkbox' => 'yes',
828 ],
829 ]
830 );
831
832 $this->add_responsive_control(
833 'radio_checkbox_border_width',
834 [
835 'label' => __('Border Width', 'master-addons' ),
836 'type' => Controls_Manager::SLIDER,
837 'range' => [
838 'px' => [
839 'min' => 0,
840 'max' => 15,
841 'step' => 1,
842 ],
843 ],
844 'size_units' => ['px'],
845 'selectors' => [
846 '{{WRAPPER}} .jltma-custom-radio-checkbox input[type="checkbox"], {{WRAPPER}} .jltma-custom-radio-checkbox input[type="radio"]' => 'border-width: {{SIZE}}{{UNIT}}',
847 ],
848 'condition' => [
849 'custom_radio_checkbox' => 'yes',
850 ],
851 ]
852 );
853
854 $this->add_control(
855 'radio_checkbox_border_color',
856 [
857 'label' => __('Border Color', 'master-addons' ),
858 'type' => Controls_Manager::COLOR,
859 'default' => '',
860 'selectors' => [
861 '{{WRAPPER}} .jltma-custom-radio-checkbox input[type="checkbox"], {{WRAPPER}} .jltma-custom-radio-checkbox input[type="radio"]' => 'border-color: {{VALUE}}',
862 ],
863 'condition' => [
864 'custom_radio_checkbox' => 'yes',
865 ],
866 ]
867 );
868
869 $this->add_control(
870 'checkbox_heading',
871 [
872 'label' => __('Checkbox', 'master-addons' ),
873 'type' => Controls_Manager::HEADING,
874 'condition' => [
875 'custom_radio_checkbox' => 'yes',
876 ],
877 ]
878 );
879
880 $this->add_control(
881 'checkbox_border_radius',
882 [
883 'label' => __('Border Radius', 'master-addons' ),
884 'type' => Controls_Manager::DIMENSIONS,
885 'size_units' => ['px', 'em', '%'],
886 'selectors' => [
887 '{{WRAPPER}} .jltma-custom-radio-checkbox input[type="checkbox"], {{WRAPPER}} .jltma-custom-radio-checkbox input[type="checkbox"]:before' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
888 ],
889 'condition' => [
890 'custom_radio_checkbox' => 'yes',
891 ],
892 ]
893 );
894
895 $this->add_control(
896 'radio_heading',
897 [
898 'label' => __('Radio Buttons', 'master-addons' ),
899 'type' => Controls_Manager::HEADING,
900 'condition' => [
901 'custom_radio_checkbox' => 'yes',
902 ],
903 ]
904 );
905
906 $this->add_control(
907 'radio_border_radius',
908 [
909 'label' => __('Border Radius', 'master-addons' ),
910 'type' => Controls_Manager::DIMENSIONS,
911 'size_units' => ['px', 'em', '%'],
912 'selectors' => [
913 '{{WRAPPER}} .jltma-custom-radio-checkbox input[type="radio"], {{WRAPPER}} .jltma-custom-radio-checkbox input[type="radio"]:before' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
914 ],
915 'condition' => [
916 'custom_radio_checkbox' => 'yes',
917 ],
918 ]
919 );
920
921 $this->end_controls_tab();
922
923 $this->start_controls_tab(
924 'radio_checkbox_checked',
925 [
926 'label' => __('Checked', 'master-addons' ),
927 'condition' => [
928 'custom_radio_checkbox' => 'yes',
929 ],
930 ]
931 );
932
933 $this->add_control(
934 'radio_checkbox_color_checked',
935 [
936 'label' => __('Color', 'master-addons' ),
937 'type' => Controls_Manager::COLOR,
938 'default' => '',
939 'selectors' => [
940 '{{WRAPPER}} .jltma-custom-radio-checkbox input[type="checkbox"]:checked:before, {{WRAPPER}} .jltma-custom-radio-checkbox input[type="radio"]:checked:before' => 'background: {{VALUE}}',
941 ],
942 'condition' => [
943 'custom_radio_checkbox' => 'yes',
944 ],
945 ]
946 );
947
948 $this->end_controls_tab();
949
950 $this->end_controls_tabs();
951
952 $this->end_controls_section();
953
954 /**
955 * Style Tab: Submit Button
956 * -------------------------------------------------
957 */
958 $this->start_controls_section(
959 'section_submit_button_style',
960 [
961 'label' => __('Submit Button', 'master-addons' ),
962 'tab' => Controls_Manager::TAB_STYLE,
963 ]
964 );
965
966 $this->add_responsive_control(
967 'button_align',
968 [
969 'label' => __('Alignment', 'master-addons' ),
970 'type' => Controls_Manager::CHOOSE,
971 'options' => [
972 'left' => [
973 'title' => __('Left', 'master-addons' ),
974 'icon' => 'eicon-h-align-left',
975 ],
976 'center' => [
977 'title' => __('Center', 'master-addons' ),
978 'icon' => 'eicon-h-align-center',
979 ],
980 'right' => [
981 'title' => __('Right', 'master-addons' ),
982 'icon' => 'eicon-h-align-right',
983 ],
984 ],
985 'default' => '',
986 'selectors' => [
987 '{{WRAPPER}} .jltma-wpforms .wpforms-submit-container' => 'text-align: {{VALUE}};',
988 '{{WRAPPER}} .jltma-wpforms .wpforms-submit-container .wpforms-submit' => 'display:inline-block;'
989 ],
990 'condition' => [
991 'button_width_type' => 'custom',
992 ],
993 ]
994 );
995
996 $this->add_control(
997 'button_width_type',
998 [
999 'label' => __('Width', 'master-addons' ),
1000 'type' => Controls_Manager::SELECT,
1001 'default' => 'custom',
1002 'options' => [
1003 'full-width' => __('Full Width', 'master-addons' ),
1004 'custom' => __('Custom', 'master-addons' ),
1005 ],
1006 'prefix_class' => 'jltma-wpforms-form-button-',
1007 ]
1008 );
1009
1010 $this->add_responsive_control(
1011 'button_width',
1012 [
1013 'label' => __('Width', 'master-addons' ),
1014 'type' => Controls_Manager::SLIDER,
1015 'default' => [
1016 'size' => '100',
1017 'unit' => 'px'
1018 ],
1019 'range' => [
1020 'px' => [
1021 'min' => 0,
1022 'max' => 1200,
1023 'step' => 1,
1024 ],
1025 ],
1026 'size_units' => ['px', '%'],
1027 'selectors' => [
1028 '{{WRAPPER}} .jltma-wpforms .wpforms-submit-container .wpforms-submit' => 'width: {{SIZE}}{{UNIT}}',
1029 ],
1030 'condition' => [
1031 'button_width_type' => 'custom',
1032 ],
1033 ]
1034 );
1035
1036 $this->start_controls_tabs('tabs_button_style');
1037
1038 $this->start_controls_tab(
1039 'tab_button_normal',
1040 [
1041 'label' => __('Normal', 'master-addons' ),
1042 ]
1043 );
1044
1045 $this->add_control(
1046 'button_bg_color_normal',
1047 [
1048 'label' => __('Background Color', 'master-addons' ),
1049 'type' => Controls_Manager::COLOR,
1050 'default' => '',
1051 'selectors' => [
1052 '{{WRAPPER}} .jltma-wpforms .wpforms-submit-container .wpforms-submit' => 'background-color: {{VALUE}}',
1053 ],
1054 ]
1055 );
1056
1057 $this->add_control(
1058 'button_text_color_normal',
1059 [
1060 'label' => __('Text Color', 'master-addons' ),
1061 'type' => Controls_Manager::COLOR,
1062 'default' => '',
1063 'selectors' => [
1064 '{{WRAPPER}} .jltma-wpforms .wpforms-submit-container .wpforms-submit' => 'color: {{VALUE}}',
1065 ],
1066 ]
1067 );
1068
1069 $this->add_group_control(
1070 Group_Control_Border::get_type(),
1071 [
1072 'name' => 'button_border_normal',
1073 'label' => __('Border', 'master-addons' ),
1074 'placeholder' => '1px',
1075 'default' => '1px',
1076 'selector' => '{{WRAPPER}} .jltma-wpforms .wpforms-submit-container .wpforms-submit',
1077 ]
1078 );
1079
1080 $this->add_control(
1081 'button_border_radius',
1082 [
1083 'label' => __('Border Radius', 'master-addons' ),
1084 'type' => Controls_Manager::DIMENSIONS,
1085 'size_units' => ['px', 'em', '%'],
1086 'selectors' => [
1087 '{{WRAPPER}} .jltma-wpforms .wpforms-submit-container .wpforms-submit' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1088 ],
1089 ]
1090 );
1091
1092 $this->add_responsive_control(
1093 'button_padding',
1094 [
1095 'label' => __('Padding', 'master-addons' ),
1096 'type' => Controls_Manager::DIMENSIONS,
1097 'size_units' => ['px', 'em', '%'],
1098 'selectors' => [
1099 '{{WRAPPER}} .jltma-wpforms .wpforms-submit-container .wpforms-submit' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1100 ],
1101 ]
1102 );
1103
1104 $this->add_responsive_control(
1105 'button_margin',
1106 [
1107 'label' => __('Margin Top', 'master-addons' ),
1108 'type' => Controls_Manager::SLIDER,
1109 'range' => [
1110 'px' => [
1111 'min' => 0,
1112 'max' => 100,
1113 'step' => 1,
1114 ],
1115 ],
1116 'size_units' => ['px', 'em', '%'],
1117 'selectors' => [
1118 '{{WRAPPER}} .jltma-wpforms .wpforms-submit-container' => 'margin-top: {{SIZE}}{{UNIT}}',
1119 ],
1120 ]
1121 );
1122
1123 $this->add_group_control(
1124 Group_Control_Typography::get_type(),
1125 [
1126 'name' => 'button_typography',
1127 'label' => __('Typography', 'master-addons' ),
1128 'global' => [
1129 'default' => Global_Typography::TYPOGRAPHY_ACCENT,
1130 ],
1131 'selector' => '{{WRAPPER}} .jltma-wpforms .wpforms-submit-container .wpforms-submit',
1132 'separator' => 'before',
1133 ]
1134 );
1135
1136 $this->add_group_control(
1137 Group_Control_Box_Shadow::get_type(),
1138 [
1139 'name' => 'button_box_shadow',
1140 'selector' => '{{WRAPPER}} .jltma-wpforms .wpforms-submit-container .wpforms-submit',
1141 'separator' => 'before',
1142 ]
1143 );
1144
1145 $this->end_controls_tab();
1146
1147 $this->start_controls_tab(
1148 'tab_button_hover',
1149 [
1150 'label' => __('Hover', 'master-addons' ),
1151 ]
1152 );
1153
1154 $this->add_control(
1155 'button_bg_color_hover',
1156 [
1157 'label' => __('Background Color', 'master-addons' ),
1158 'type' => Controls_Manager::COLOR,
1159 'default' => '',
1160 'selectors' => [
1161 '{{WRAPPER}} .jltma-wpforms .wpforms-submit-container .wpforms-submit:hover' => 'background-color: {{VALUE}}',
1162 ],
1163 ]
1164 );
1165
1166 $this->add_control(
1167 'button_text_color_hover',
1168 [
1169 'label' => __('Text Color', 'master-addons' ),
1170 'type' => Controls_Manager::COLOR,
1171 'default' => '',
1172 'selectors' => [
1173 '{{WRAPPER}} .jltma-wpforms .wpforms-submit-container .wpforms-submit:hover' => 'color: {{VALUE}}',
1174 ],
1175 ]
1176 );
1177
1178 $this->add_control(
1179 'button_border_color_hover',
1180 [
1181 'label' => __('Border Color', 'master-addons' ),
1182 'type' => Controls_Manager::COLOR,
1183 'default' => '',
1184 'selectors' => [
1185 '{{WRAPPER}} .jltma-wpforms .wpforms-submit-container .wpforms-submit:hover' => 'border-color: {{VALUE}}',
1186 ],
1187 ]
1188 );
1189
1190 $this->end_controls_tab();
1191
1192 $this->end_controls_tabs();
1193
1194 $this->end_controls_section();
1195
1196 /**
1197 * Style Tab: Errors
1198 * -------------------------------------------------
1199 */
1200 $this->start_controls_section(
1201 'section_error_style',
1202 [
1203 'label' => __('Errors', 'master-addons' ),
1204 'tab' => Controls_Manager::TAB_STYLE,
1205 'condition' => [
1206 'error_messages' => 'show',
1207 ],
1208 ]
1209 );
1210
1211 $this->add_control(
1212 'error_message_text_color',
1213 [
1214 'label' => __('Text Color', 'master-addons' ),
1215 'type' => Controls_Manager::COLOR,
1216 'default' => '',
1217 'selectors' => [
1218 '{{WRAPPER}} .jltma-wpforms label.wpforms-error' => 'color: {{VALUE}}',
1219 ],
1220 'condition' => [
1221 'error_messages' => 'show',
1222 ],
1223 ]
1224 );
1225
1226 $this->add_control(
1227 'error_field_input_border_color',
1228 [
1229 'label' => __('Error Field Input Border Color', 'master-addons' ),
1230 'type' => Controls_Manager::COLOR,
1231 'default' => '',
1232 'selectors' => [
1233 '{{WRAPPER}} .jltma-wpforms input.wpforms-error, {{WRAPPER}} .jltma-wpforms textarea.wpforms-error'
1234 => 'border-color: {{VALUE}}',
1235 ],
1236 'condition' => [
1237 'error_messages' => 'show',
1238 ],
1239 ]
1240 );
1241
1242 $this->add_control(
1243 'error_field_input_border_width',
1244 [
1245 'label' => __('Error Field Input Border Width', 'master-addons' ),
1246 'type' => Controls_Manager::NUMBER,
1247 'default' => 1,
1248 'min' => 1,
1249 'max' => 10,
1250 'step' => 1,
1251 'selectors' => [
1252 '{{WRAPPER}} .jltma-wpforms input.wpforms-error, {{WRAPPER}} .jltma-wpforms textarea.wpforms-error'
1253 => 'border-width: {{VALUE}}px',
1254 ],
1255 'condition' => [
1256 'error_messages' => 'show',
1257 ],
1258 ]
1259 );
1260
1261 $this->end_controls_section();
1262
1263 // Help Docs section (links from config.php)
1264 $this->jltma_help_docs('wpforms');
1265
1266 $this->upgrade_to_pro_message();
1267
1268 }
1269
1270 protected function render()
1271 {
1272 $settings = $this->get_settings();
1273
1274 // if WP Forms Missing
1275 if (!function_exists('wpforms')) {
1276 Helper::jltma_elementor_plugin_missing_notice(array(
1277 'title' => esc_html__('WPForms is Not Activated!', 'master-addons'),
1278 'description' => esc_html__('To use this widget, please install and activate the "WPForms" plugin.', 'master-addons'),
1279 ));
1280 return;
1281 }
1282
1283 $this->add_render_attribute(
1284 'contact-form',
1285 'class',
1286 [
1287 'jltma-contact-form',
1288 'jltma-wpforms',
1289 'ma-cf',
1290 'ma-cf-' . esc_attr($settings['ma_wpform_layout_style']),
1291 ]
1292 );
1293
1294 if ($settings['placeholder_switch'] != 'yes') {
1295 $this->add_render_attribute('contact-form', 'class', 'placeholder-hide');
1296 }
1297
1298 if ($settings['custom_title_description'] == 'yes') {
1299 $this->add_render_attribute('contact-form', 'class', 'title-description-hide');
1300 }
1301
1302 if ($settings['custom_radio_checkbox'] == 'yes') {
1303 $this->add_render_attribute('contact-form', 'class', 'jltma-custom-radio-checkbox');
1304 }
1305
1306 if (class_exists('WPForms')) {
1307 if (!empty($settings['contact_form_list'])) { ?>
1308 <div <?php echo $this->get_render_attribute_string('contact-form'); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Elementor render_attribute_string returns sanitized HTML attributes ?>>
1309 <?php if ($settings['custom_title_description'] == 'yes') { ?>
1310 <div class="jltma-wpforms-heading">
1311 <?php if ($settings['form_title_custom'] != '') { ?>
1312 <h3 class="jltma-contact-form-title jltma-wpforms-title">
1313 <?php echo esc_attr($settings['form_title_custom']); ?>
1314 </h3>
1315 <?php } ?>
1316 <?php if ($settings['form_description_custom'] != '') { ?>
1317 <div class="jltma-contact-form-description jltma-wpforms-description">
1318 <?php echo $this->parse_text_editor($settings['form_description_custom']); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- parse_text_editor returns Elementor-processed safe HTML ?>
1319 </div>
1320 <?php } ?>
1321 </div>
1322 <?php } ?>
1323 <?php
1324 $ma_el_form_title = $settings['form_title'];
1325 $ma_el_form_description = $settings['form_description'];
1326
1327 if ($settings['custom_title_description'] == 'yes') {
1328 $ma_el_form_title = false;
1329 $ma_el_form_description = false;
1330 }
1331
1332 echo wpforms_display( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- wpforms_display returns WPForms' own sanitized form HTML
1333 $settings['contact_form_list'],
1334 $ma_el_form_title,
1335 $ma_el_form_description
1336 );
1337 ?>
1338 </div>
1339 <?php
1340 }
1341 }
1342 }
1343
1344 protected function content_template()
1345 {
1346 }
1347 }
1348