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

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

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