PluginProbe
Hello Plus / 1.2.0
Hello Plus v1.2.0
trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.2.1 1.3.0 1.4.0 1.4.1 1.5.0 1.5.1 1.5.2 1.5.3 1.6.0 1.6.1 1.6.2 1.7.0 1.7.1 1.7.2 1.7.3 All 30 releases
hello-plus / modules / forms / widgets / ehp-form.php

ehp-form.php in Hello Plus 1.2.0, at modules/forms/widgets/ehp-form.php

1,805 lines 41.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace HelloPlus\Modules\Forms\Widgets;
3
4 use Elementor\Controls_Manager;
5 use Elementor\Core\Kits\Documents\Tabs\Global_Colors;
6 use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
7 use Elementor\Group_Control_Background;
8 use Elementor\Group_Control_Typography;
9 use Elementor\Modules\DynamicTags\Module as TagsModule;
10 use Elementor\Repeater;
11 use HelloPlus\Includes\Utils;
12 use HelloPlus\Modules\Forms\Classes\Form_Base;
13 use HelloPlus\Modules\Forms\Classes\Render\Widget_Form_Render;
14 use HelloPlus\Modules\Forms\Components\Ajax_Handler;
15 use HelloPlus\Modules\Forms\Controls\Fields_Repeater;
16 use HelloPlus\Modules\Forms\Module;
17
18 if ( ! defined( 'ABSPATH' ) ) {
19 exit; // Exit if accessed directly
20 }
21
22 class Ehp_Form extends Form_Base {
23
24 public function get_name() {
25 return 'ehp-form';
26 }
27
28 public function get_title() {
29 return esc_html__( 'Form Lite', 'hello-plus' );
30 }
31
32 public function get_icon() {
33 return 'eicon-ehp-forms';
34 }
35
36 public function get_keywords() {
37 return [ 'form', 'forms', 'field', 'button' ];
38 }
39
40 protected function is_dynamic_content(): bool {
41 return false;
42 }
43
44 protected function get_upsale_data(): array {
45 return [
46 'condition' => ! Utils::has_pro(),
47 'image' => esc_url( HELLOPLUS_IMAGES_URL . 'go-pro.svg' ),
48 'image_alt' => esc_attr__( 'Upgrade Now', 'hello-plus' ),
49 'title' => esc_html__( 'Take your forms further', 'hello-plus' ),
50 'description' => esc_html__( 'Unlock advanced form customization and field options with Elementor Pro.', 'hello-plus' ),
51 'upgrade_url' => esc_url( 'https://go.elementor.com/form-lite-widget-elementor-plugin-pricing/' ),
52 'upgrade_text' => esc_html__( 'Upgrade Now', 'hello-plus' ),
53 ];
54 }
55
56 /**
57 * Get style dependencies.
58 *
59 * Retrieve the list of style dependencies the widget requires.
60 *
61 * @since 3.24.0
62 * @access public
63 *
64 * @return array Widget style dependencies.
65 */
66 public function get_style_depends(): array {
67 return [ 'helloplus-forms' ];
68 }
69
70 public function get_script_depends(): array {
71 return [ 'helloplus-forms-fe' ];
72 }
73
74 protected function render(): void {
75 $render_strategy = new Widget_Form_Render( $this );
76
77 $render_strategy->render();
78 }
79
80 protected function register_controls() {
81 $this->add_content_text_section();
82 $this->add_content_form_fields_section();
83 $this->add_content_button_section();
84 $this->add_content_actions_after_submit_section();
85 $this->add_content_additional_options_section();
86
87 $this->add_style_text_section();
88 $this->add_style_form_section();
89 $this->add_style_fields_section();
90 $this->add_style_buttons_section();
91 $this->add_style_messages_section();
92 $this->add_style_box_section();
93 }
94
95 protected function add_content_text_section(): void {
96 $this->start_controls_section(
97 'section_text',
98 [
99 'label' => esc_html__( 'Text', 'hello-plus' ),
100 ]
101 );
102
103 $this->add_control(
104 'text_heading',
105 [
106 'label' => esc_html__( 'Heading', 'hello-plus' ),
107 'type' => Controls_Manager::TEXTAREA,
108 'default' => esc_html__( 'Contact Us', 'hello-plus' ),
109 'placeholder' => esc_html__( 'Add your text here', 'hello-plus' ),
110 'dynamic' => [
111 'active' => true,
112 ],
113 ]
114 );
115
116 $this->add_control(
117 'text_heading_tag',
118 [
119 'label' => esc_html__( 'Heading HTML Tag', 'hello-plus' ),
120 'type' => Controls_Manager::SELECT,
121 'options' => [
122 'h1' => 'H1',
123 'h2' => 'H2',
124 'h3' => 'H3',
125 'h4' => 'H4',
126 'h5' => 'H5',
127 'h6' => 'H6',
128 'div' => 'div',
129 'span' => 'span',
130 'p' => 'p',
131 ],
132 'default' => 'h2',
133 ]
134 );
135
136 $this->add_control(
137 'text_description',
138 [
139 'label' => esc_html__( 'Description', 'hello-plus' ),
140 'type' => Controls_Manager::TEXTAREA,
141 'default' => esc_html__( 'Fill out the form below and we will contact you as soon as possible', 'hello-plus' ),
142 'placeholder' => esc_html__( 'Add your text here', 'hello-plus' ),
143 'dynamic' => [
144 'active' => true,
145 ],
146 ]
147 );
148
149 $this->end_controls_section();
150 }
151
152 protected function add_content_form_fields_section(): void {
153 $repeater = new Repeater();
154
155 $field_types = [
156 'text' => esc_html__( 'Text', 'hello-plus' ),
157 'email' => esc_html__( 'Email', 'hello-plus' ),
158 'textarea' => esc_html__( 'Textarea', 'hello-plus' ),
159 'ehp-tel' => esc_html__( 'Tel', 'hello-plus' ),
160 'select' => esc_html__( 'Select', 'hello-plus' ),
161 'ehp-acceptance' => esc_html__( 'Acceptance', 'hello-plus' ),
162 ];
163
164 $repeater->start_controls_tabs( 'form_fields_tabs' );
165
166 $repeater->start_controls_tab( 'form_fields_content_tab', [
167 'label' => esc_html__( 'Content', 'hello-plus' ),
168 ] );
169
170 $repeater->add_control(
171 'field_type',
172 [
173 'label' => esc_html__( 'Type', 'hello-plus' ),
174 'type' => Controls_Manager::SELECT,
175 'options' => $field_types,
176 'default' => 'text',
177 ]
178 );
179
180 $repeater->add_control(
181 'field_label',
182 [
183 'label' => esc_html__( 'Label', 'hello-plus' ),
184 'type' => Controls_Manager::TEXT,
185 'default' => '',
186 'dynamic' => [
187 'active' => true,
188 ],
189 ]
190 );
191
192 $repeater->add_control(
193 'placeholder',
194 [
195 'label' => esc_html__( 'Placeholder', 'hello-plus' ),
196 'type' => Controls_Manager::TEXT,
197 'default' => '',
198 'conditions' => [
199 'terms' => [
200 [
201 'name' => 'field_type',
202 'operator' => 'in',
203 'value' => [
204 'ehp-tel',
205 'text',
206 'email',
207 'textarea',
208 ],
209 ],
210 ],
211 ],
212 'dynamic' => [
213 'active' => true,
214 ],
215 ]
216 );
217
218 $repeater->add_control(
219 'required',
220 [
221 'label' => esc_html__( 'Required', 'hello-plus' ),
222 'type' => Controls_Manager::SWITCHER,
223 'return_value' => 'true',
224 'default' => '',
225 ]
226 );
227
228 $repeater->add_control(
229 'field_options',
230 [
231 'label' => esc_html__( 'Options', 'hello-plus' ),
232 'type' => Controls_Manager::TEXTAREA,
233 'default' => '',
234 'description' => esc_html__( 'Enter each option in a separate line. To differentiate between label and value, separate them with a pipe char ("|"). For example: First Name|f_name', 'hello-plus' ),
235 'conditions' => [
236 'terms' => [
237 [
238 'name' => 'field_type',
239 'operator' => 'in',
240 'value' => [
241 'select',
242 ],
243 ],
244 ],
245 ],
246 ]
247 );
248
249 $repeater->add_control(
250 'allow_multiple',
251 [
252 'label' => esc_html__( 'Multiple Selection', 'hello-plus' ),
253 'type' => Controls_Manager::SWITCHER,
254 'return_value' => 'true',
255 'conditions' => [
256 'terms' => [
257 [
258 'name' => 'field_type',
259 'value' => 'select',
260 ],
261 ],
262 ],
263 ]
264 );
265
266 $repeater->add_control(
267 'select_size',
268 [
269 'label' => esc_html__( 'Rows', 'hello-plus' ),
270 'type' => Controls_Manager::NUMBER,
271 'min' => 2,
272 'step' => 1,
273 'conditions' => [
274 'terms' => [
275 [
276 'name' => 'field_type',
277 'value' => 'select',
278 ],
279 [
280 'name' => 'allow_multiple',
281 'value' => 'true',
282 ],
283 ],
284 ],
285 ]
286 );
287
288 $repeater->add_responsive_control(
289 'width',
290 [
291 'label' => esc_html__( 'Column Width', 'hello-plus' ),
292 'type' => Controls_Manager::SELECT,
293 'options' => [
294 '100' => '100%',
295 '50' => '50%',
296 '33' => '33%',
297 ],
298 'default' => '100',
299 'tablet_default' => '100',
300 'mobile_default' => '100',
301 ]
302 );
303
304 $repeater->add_control(
305 'rows',
306 [
307 'label' => esc_html__( 'Rows', 'hello-plus' ),
308 'type' => Controls_Manager::NUMBER,
309 'default' => 4,
310 'conditions' => [
311 'terms' => [
312 [
313 'name' => 'field_type',
314 'value' => 'textarea',
315 ],
316 ],
317 ],
318 ]
319 );
320
321 $repeater->add_control(
322 'css_classes',
323 [
324 'label' => esc_html__( 'CSS Classes', 'hello-plus' ),
325 'type' => Controls_Manager::HIDDEN,
326 'default' => '',
327 'title' => esc_html__( 'Add your custom class WITHOUT the dot. e.g: my-class', 'hello-plus' ),
328 ]
329 );
330
331 $repeater->end_controls_tab();
332
333 $repeater->start_controls_tab(
334 'form_fields_advanced_tab',
335 [
336 'label' => esc_html__( 'Advanced', 'hello-plus' ),
337 'condition' => [
338 'field_type!' => 'html',
339 ],
340 ]
341 );
342
343 $repeater->add_control(
344 'field_value',
345 [
346 'label' => esc_html__( 'Default Value', 'hello-plus' ),
347 'type' => Controls_Manager::TEXT,
348 'default' => '',
349 'dynamic' => [
350 'active' => true,
351 ],
352 'ai' => [
353 'active' => false,
354 ],
355 'conditions' => [
356 'terms' => [
357 [
358 'name' => 'field_type',
359 'operator' => 'in',
360 'value' => [
361 'text',
362 'email',
363 'textarea',
364 'tel',
365 'select',
366 ],
367 ],
368 ],
369 ],
370 ]
371 );
372
373 $repeater->add_control(
374 'custom_id',
375 [
376 'label' => esc_html__( 'ID', 'hello-plus' ),
377 'type' => Controls_Manager::TEXT,
378 'description' => sprintf(
379 /* translators: %1$s: Opening code tag, %2$s: Closing code tag. */
380 esc_html__( 'Please make sure the ID is unique and not used elsewhere on the page. This field allows %1$sA-z 0-9%2$s & underscore chars without spaces.', 'hello-plus' ),
381 '<code>',
382 '</code>'
383 ),
384 'render_type' => 'none',
385 'required' => true,
386 'dynamic' => [
387 'active' => true,
388 ],
389 'ai' => [
390 'active' => false,
391 ],
392 ]
393 );
394
395 $shortcode_template = '{{ view.container.settings.get( \'custom_id\' ) }}';
396
397 $repeater->add_control(
398 'shortcode',
399 [
400 'label' => esc_html__( 'Shortcode', 'hello-plus' ),
401 'type' => Controls_Manager::RAW_HTML,
402 'classes' => 'forms-field-shortcode',
403 'raw' => '<input class="elementor-form-field-shortcode" value=\'[field id="' . $shortcode_template . '"]\' readonly />',
404 ]
405 );
406
407 $repeater->end_controls_tab();
408
409 $repeater->end_controls_tabs();
410
411 $this->start_controls_section(
412 'section_form_fields',
413 [
414 'label' => esc_html__( 'Form Fields', 'hello-plus' ),
415 ]
416 );
417
418 $this->add_control(
419 'form_name',
420 [
421 'label' => esc_html__( 'Form Name', 'hello-plus' ),
422 'type' => Controls_Manager::TEXT,
423 'default' => esc_html__( 'New Form', 'hello-plus' ),
424 'placeholder' => esc_html__( 'Form Name', 'hello-plus' ),
425 ]
426 );
427
428 $this->add_control(
429 'form_fields',
430 [
431 'type' => Fields_Repeater::CONTROL_TYPE,
432 'fields' => $repeater->get_controls(),
433 'default' => [
434 [
435 'custom_id' => 'name',
436 'field_type' => 'text',
437 'field_label' => esc_html__( 'Name', 'hello-plus' ),
438 'placeholder' => esc_html__( 'Name', 'hello-plus' ),
439 'width' => '100',
440 'dynamic' => [
441 'active' => true,
442 ],
443 ],
444 [
445 'custom_id' => 'email',
446 'field_type' => 'email',
447 'required' => 'true',
448 'field_label' => esc_html__( 'Email', 'hello-plus' ),
449 'placeholder' => esc_html__( 'Email', 'hello-plus' ),
450 'width' => '100',
451 ],
452 [
453 'custom_id' => 'message',
454 'field_type' => 'textarea',
455 'field_label' => esc_html__( 'Message', 'hello-plus' ),
456 'placeholder' => esc_html__( 'Message', 'hello-plus' ),
457 'width' => '100',
458 ],
459 ],
460 'title_field' => '{{{ field_label }}}',
461 ]
462 );
463
464 $this->add_control(
465 'show_labels',
466 [
467 'label' => esc_html__( 'Label', 'hello-plus' ),
468 'type' => Controls_Manager::SWITCHER,
469 'label_on' => esc_html__( 'Show', 'hello-plus' ),
470 'label_off' => esc_html__( 'Hide', 'hello-plus' ),
471 'return_value' => 'true',
472 'default' => 'true',
473 'separator' => 'before',
474 ]
475 );
476
477 $this->add_control(
478 'mark_required',
479 [
480 'label' => esc_html__( 'Required Mark', 'hello-plus' ),
481 'type' => Controls_Manager::SWITCHER,
482 'label_on' => esc_html__( 'Show', 'hello-plus' ),
483 'label_off' => esc_html__( 'Hide', 'hello-plus' ),
484 'default' => '',
485 'condition' => [
486 'show_labels!' => '',
487 ],
488 ]
489 );
490
491 $this->end_controls_section();
492 }
493
494 protected function add_content_button_section(): void {
495 $this->start_controls_section(
496 'section_buttons',
497 [
498 'label' => esc_html__( 'Button', 'hello-plus' ),
499 ]
500 );
501
502 $this->add_responsive_control(
503 'button_width',
504 [
505 'label' => esc_html__( 'Column Width', 'hello-plus' ),
506 'type' => Controls_Manager::SELECT,
507 'options' => [
508 '100' => '100%',
509 '50' => '50%',
510 '33' => '33%',
511 ],
512 'default' => '100',
513 'frontend_available' => true,
514 ]
515 );
516
517 $this->add_control(
518 'button_text',
519 [
520 'label' => esc_html__( 'Submit', 'hello-plus' ),
521 'type' => Controls_Manager::TEXT,
522 'default' => esc_html__( 'Send', 'hello-plus' ),
523 'placeholder' => esc_html__( 'Send', 'hello-plus' ),
524 'dynamic' => [
525 'active' => true,
526 ],
527 'ai' => [
528 'active' => false,
529 ],
530 ]
531 );
532
533 $this->add_control(
534 'selected_button_icon',
535 [
536 'label' => esc_html__( 'Icon', 'hello-plus' ),
537 'type' => Controls_Manager::ICONS,
538 'skin' => 'inline',
539 'label_block' => false,
540 ]
541 );
542
543 $this->add_control(
544 'button_css_id',
545 [
546 'label' => esc_html__( 'Button ID', 'hello-plus' ),
547 'type' => Controls_Manager::TEXT,
548 'default' => '',
549 'ai' => [
550 'active' => false,
551 ],
552 'title' => esc_html__( 'Add your custom id WITHOUT the Pound key. e.g: my-id', 'hello-plus' ),
553 'description' => sprintf(
554 /* translators: %1$s: Opening code tag, %2$s: Closing code tag. */
555 esc_html__( 'Please make sure the ID is unique and not used elsewhere on the page. This field allows %1$sA-z 0-9%2$s & underscore chars without spaces.', 'hello-plus' ),
556 '<code>',
557 '</code>'
558 ),
559 'separator' => 'before',
560 'dynamic' => [
561 'active' => true,
562 ],
563 ]
564 );
565
566 $this->end_controls_section();
567 }
568
569 protected function add_content_actions_after_submit_section(): void {
570 $this->start_controls_section(
571 'section_integration',
572 [
573 'label' => esc_html__( 'Actions After Submit', 'hello-plus' ),
574 ]
575 );
576
577 $this->add_control(
578 'should_redirect',
579 [
580 'label' => esc_html__( 'Redirect To Thank You Page', 'hello-plus' ),
581 'type' => Controls_Manager::SWITCHER,
582 'label_on' => esc_html__( 'Yes', 'hello-plus' ),
583 'label_off' => esc_html__( 'No', 'hello-plus' ),
584 'return_value' => 'true',
585 'default' => '',
586 ]
587 );
588
589 $this->add_control(
590 'redirect_to',
591 [
592 'label' => esc_html__( 'Redirect To', 'hello-plus' ),
593 'type' => Controls_Manager::TEXT,
594 'placeholder' => esc_html__( 'https://your-link.com', 'hello-plus' ),
595 'ai' => [
596 'active' => false,
597 ],
598 'dynamic' => [
599 'active' => true,
600 'categories' => [
601 TagsModule::POST_META_CATEGORY,
602 TagsModule::TEXT_CATEGORY,
603 TagsModule::URL_CATEGORY,
604 ],
605 ],
606 'label_block' => true,
607 'render_type' => 'none',
608 'classes' => 'elementor-control-direction-ltr',
609 'condition' => [
610 'should_redirect' => 'true',
611 ],
612 ]
613 );
614
615 $this->add_control(
616 'email_heading',
617 [
618 'label' => esc_html__( 'Email Submissions', 'hello-plus' ),
619 'type' => Controls_Manager::HEADING,
620 'separator' => 'before',
621 ]
622 );
623
624 $this->add_control(
625 'email_to',
626 [
627 'label' => esc_html__( 'To', 'hello-plus' ),
628 'type' => Controls_Manager::TEXT,
629 'default' => get_option( 'admin_email' ),
630 'ai' => [
631 'active' => false,
632 ],
633 'placeholder' => get_option( 'admin_email' ),
634 'label_block' => true,
635 'title' => esc_html__( 'Separate emails with commas', 'hello-plus' ),
636 'render_type' => 'none',
637 'dynamic' => [
638 'active' => true,
639 ],
640 ]
641 );
642
643 /* translators: %s: Site title. */
644 $default_message = sprintf( esc_html__( 'New message from [%s]', 'hello-plus' ), get_bloginfo( 'name' ) );
645
646 $this->add_control(
647 'email_subject',
648 [
649 'label' => esc_html__( 'Subject', 'hello-plus' ),
650 'type' => Controls_Manager::TEXT,
651 'default' => $default_message,
652 'ai' => [
653 'active' => false,
654 ],
655 'placeholder' => $default_message,
656 'label_block' => true,
657 'render_type' => 'none',
658 'dynamic' => [
659 'active' => true,
660 ],
661 ]
662 );
663
664 $this->add_control(
665 'email_content',
666 [
667 'label' => esc_html__( 'Message', 'hello-plus' ),
668 'type' => Controls_Manager::TEXTAREA,
669 'default' => '[all-fields]',
670 'ai' => [
671 'active' => false,
672 ],
673 'placeholder' => '[all-fields]',
674 'description' => sprintf(
675 /* translators: %s: The [all-fields] shortcode. */
676 esc_html__( 'By default, all form fields are sent via %s shortcode. To customize sent fields, copy the shortcode that appears inside each field and paste it above.', 'hello-plus' ),
677 '<code>[all-fields]</code>'
678 ),
679 'render_type' => 'none',
680 'dynamic' => [
681 'active' => true,
682 ],
683 ]
684 );
685
686 $site_domain = Module::get_site_domain();
687
688 $this->add_control(
689 'email_from',
690 [
691 'label' => esc_html__( 'From Email', 'hello-plus' ),
692 'type' => Controls_Manager::TEXT,
693 'default' => 'email@' . $site_domain,
694 'ai' => [
695 'active' => false,
696 ],
697 'render_type' => 'none',
698 'dynamic' => [
699 'active' => true,
700 ],
701 ]
702 );
703
704 $this->add_control(
705 'email_from_name',
706 [
707 'label' => esc_html__( 'From Name', 'hello-plus' ),
708 'type' => Controls_Manager::TEXT,
709 'default' => get_bloginfo( 'name' ),
710 'ai' => [
711 'active' => false,
712 ],
713 'render_type' => 'none',
714 'dynamic' => [
715 'active' => true,
716 ],
717 ]
718 );
719
720 $this->add_control(
721 'email_reply_to',
722 [
723 'label' => esc_html__( 'Reply-To', 'hello-plus' ),
724 'type' => Controls_Manager::SELECT,
725 'options' => [
726 '' => '',
727 ],
728 'render_type' => 'none',
729 ]
730 );
731
732 $this->add_control(
733 'email_to_cc',
734 [
735 'label' => esc_html__( 'Cc', 'hello-plus' ),
736 'type' => Controls_Manager::TEXT,
737 'default' => '',
738 'ai' => [
739 'active' => false,
740 ],
741 'title' => esc_html__( 'Separate emails with commas', 'hello-plus' ),
742 'render_type' => 'none',
743 'dynamic' => [
744 'active' => true,
745 ],
746 ]
747 );
748
749 $this->add_control(
750 'email_to_bcc',
751 [
752 'label' => esc_html__( 'Bcc', 'hello-plus' ),
753 'type' => Controls_Manager::TEXT,
754 'default' => '',
755 'ai' => [
756 'active' => false,
757 ],
758 'title' => esc_html__( 'Separate emails with commas', 'hello-plus' ),
759 'render_type' => 'none',
760 'dynamic' => [
761 'active' => true,
762 ],
763 ]
764 );
765
766 $this->add_control(
767 'form_metadata',
768 [
769 'label' => esc_html__( 'Meta Data', 'hello-plus' ),
770 'type' => Controls_Manager::SELECT2,
771 'multiple' => true,
772 'label_block' => true,
773 'separator' => 'before',
774 'default' => [
775 'date',
776 'time',
777 'page_url',
778 'user_agent',
779 'remote_ip',
780 'credit',
781 ],
782 'options' => [
783 'date' => esc_html__( 'Date', 'hello-plus' ),
784 'time' => esc_html__( 'Time', 'hello-plus' ),
785 'page_url' => esc_html__( 'Page URL', 'hello-plus' ),
786 'user_agent' => esc_html__( 'User Agent', 'hello-plus' ),
787 'remote_ip' => esc_html__( 'Remote IP', 'hello-plus' ),
788 'credit' => esc_html__( 'Credit', 'hello-plus' ),
789 ],
790 'render_type' => 'none',
791 ]
792 );
793
794 $this->add_control(
795 'email_content_type',
796 [
797 'label' => esc_html__( 'Send As', 'hello-plus' ),
798 'type' => Controls_Manager::SELECT,
799 'default' => 'html',
800 'render_type' => 'none',
801 'options' => [
802 'html' => esc_html__( 'HTML', 'hello-plus' ),
803 'plain' => esc_html__( 'Plain', 'hello-plus' ),
804 ],
805 ]
806 );
807
808 $this->end_controls_section();
809 }
810
811 protected function add_content_additional_options_section(): void {
812 $this->start_controls_section(
813 'section_form_options',
814 [
815 'label' => esc_html__( 'Additional Options', 'hello-plus' ),
816 'tab' => Controls_Manager::TAB_CONTENT,
817 ]
818 );
819
820 $this->add_control(
821 'form_id',
822 [
823 'label' => esc_html__( 'Form ID', 'hello-plus' ),
824 'type' => Controls_Manager::TEXT,
825 'ai' => [
826 'active' => false,
827 ],
828 'placeholder' => 'new_form_id',
829 'description' => sprintf(
830 /* translators: %1$s: Opening code tag, %2$s: Closing code tag. */
831 esc_html__( 'Please make sure the ID is unique and not used elsewhere on the page. This field allows %1$sA-z 0-9%2$s & underscore chars without spaces.', 'hello-plus' ),
832 '<code>',
833 '</code>'
834 ),
835 'separator' => 'after',
836 'dynamic' => [
837 'active' => true,
838 ],
839 ]
840 );
841
842 $this->add_control(
843 'custom_messages',
844 [
845 'label' => esc_html__( 'Custom Messages', 'hello-plus' ),
846 'type' => Controls_Manager::SWITCHER,
847 'default' => '',
848 'separator' => 'before',
849 'render_type' => 'none',
850 ]
851 );
852
853 $default_messages = Ajax_Handler::get_default_messages();
854
855 $this->add_control(
856 'success_message',
857 [
858 'label' => esc_html__( 'Success Message', 'hello-plus' ),
859 'type' => Controls_Manager::TEXT,
860 'default' => $default_messages[ Ajax_Handler::SUCCESS ],
861 'placeholder' => $default_messages[ Ajax_Handler::SUCCESS ],
862 'label_block' => true,
863 'condition' => [
864 'custom_messages!' => '',
865 ],
866 'render_type' => 'none',
867 'dynamic' => [
868 'active' => true,
869 ],
870 ]
871 );
872
873 $this->add_control(
874 'error_message',
875 [
876 'label' => esc_html__( 'Form Error', 'hello-plus' ),
877 'type' => Controls_Manager::TEXT,
878 'default' => $default_messages[ Ajax_Handler::ERROR ],
879 'placeholder' => $default_messages[ Ajax_Handler::ERROR ],
880 'label_block' => true,
881 'condition' => [
882 'custom_messages!' => '',
883 ],
884 'render_type' => 'none',
885 'dynamic' => [
886 'active' => true,
887 ],
888 ]
889 );
890
891 $this->add_control(
892 'server_message',
893 [
894 'label' => esc_html__( 'Server Error', 'hello-plus' ),
895 'type' => Controls_Manager::TEXT,
896 'default' => $default_messages[ Ajax_Handler::SERVER_ERROR ],
897 'placeholder' => $default_messages[ Ajax_Handler::SERVER_ERROR ],
898 'label_block' => true,
899 'condition' => [
900 'custom_messages!' => '',
901 ],
902 'render_type' => 'none',
903 'dynamic' => [
904 'active' => true,
905 ],
906 ]
907 );
908
909 $this->add_control(
910 'invalid_message',
911 [
912 'label' => esc_html__( 'Invalid Form', 'hello-plus' ),
913 'type' => Controls_Manager::TEXT,
914 'default' => $default_messages[ Ajax_Handler::INVALID_FORM ],
915 'placeholder' => $default_messages[ Ajax_Handler::INVALID_FORM ],
916 'label_block' => true,
917 'condition' => [
918 'custom_messages!' => '',
919 ],
920 'render_type' => 'none',
921 'dynamic' => [
922 'active' => true,
923 ],
924 ]
925 );
926
927 $this->end_controls_section();
928 }
929
930 protected function add_style_text_section(): void {
931 $this->start_controls_section(
932 'section_text_style',
933 [
934 'label' => esc_html__( 'Text', 'hello-plus' ),
935 'tab' => Controls_Manager::TAB_STYLE,
936 ]
937 );
938
939 $this->add_control(
940 'text_align',
941 [
942 'label' => esc_html__( 'Align', 'hello-plus' ),
943 'type' => Controls_Manager::CHOOSE,
944 'options' => [
945 'flex-start' => [
946 'title' => esc_html__( 'Left', 'hello-plus' ),
947 'icon' => 'eicon-text-align-left',
948 ],
949 'center' => [
950 'title' => esc_html__( 'Center', 'hello-plus' ),
951 'icon' => 'eicon-text-align-center',
952 ],
953 'flex-end' => [
954 'title' => esc_html__( 'Right', 'hello-plus' ),
955 'icon' => 'eicon-text-align-right',
956 ],
957 ],
958 'default' => 'center',
959 'selectors' => [
960 '{{WRAPPER}} .ehp-form' => '--ehp-form-text-container-align: {{VALUE}};',
961 ],
962 ]
963 );
964
965 $this->add_control(
966 'heading_text',
967 [
968 'label' => esc_html__( 'Heading', 'hello-plus' ),
969 'type' => Controls_Manager::HEADING,
970 ]
971 );
972
973 $this->add_control(
974 'heading_color',
975 [
976 'label' => esc_html__( 'Text Color', 'hello-plus' ),
977 'type' => Controls_Manager::COLOR,
978 'selectors' => [
979 '{{WRAPPER}} .ehp-form' => '--ehp-form-heading-color: {{VALUE}};',
980 ],
981 'global' => [
982 'default' => Global_Colors::COLOR_PRIMARY,
983 ],
984 ]
985 );
986
987 $this->add_group_control(
988 Group_Control_Typography::get_type(),
989 [
990 'name' => 'heading_typography',
991 'selector' => '{{WRAPPER}} .ehp-form__heading',
992 'global' => [
993 'default' => Global_Typography::TYPOGRAPHY_PRIMARY,
994 ],
995 ]
996 );
997
998 $this->add_control(
999 'heading_description',
1000 [
1001 'label' => esc_html__( 'Description', 'hello-plus' ),
1002 'type' => Controls_Manager::HEADING,
1003 ]
1004 );
1005
1006 $this->add_control(
1007 'description_color',
1008 [
1009 'label' => esc_html__( 'Text Color', 'hello-plus' ),
1010 'type' => Controls_Manager::COLOR,
1011 'selectors' => [
1012 '{{WRAPPER}} .ehp-form' => '--ehp-form-description-color: {{VALUE}};',
1013 ],
1014 'global' => [
1015 'default' => Global_Colors::COLOR_TEXT,
1016 ],
1017 ]
1018 );
1019
1020 $this->add_group_control(
1021 Group_Control_Typography::get_type(),
1022 [
1023 'name' => 'description_typography',
1024 'selector' => '{{WRAPPER}} .ehp-form__description',
1025 'global' => [
1026 'default' => Global_Typography::TYPOGRAPHY_TEXT,
1027 ],
1028 ]
1029 );
1030
1031 $this->end_controls_section();
1032 }
1033
1034 protected function add_style_form_section(): void {
1035 $this->start_controls_section(
1036 'section_form_style',
1037 [
1038 'label' => esc_html__( 'Form', 'hello-plus' ),
1039 'tab' => Controls_Manager::TAB_STYLE,
1040 ]
1041 );
1042
1043 $this->add_control(
1044 'column_gap',
1045 [
1046 'label' => esc_html__( 'Columns Gap', 'hello-plus' ),
1047 'type' => Controls_Manager::SLIDER,
1048 'size_units' => [ 'px', 'em', 'rem', 'custom' ],
1049 'default' => [
1050 'size' => 32,
1051 'unit' => 'px',
1052 ],
1053 'range' => [
1054 'px' => [
1055 'max' => 60,
1056 ],
1057 'em' => [
1058 'max' => 6,
1059 ],
1060 'rem' => [
1061 'max' => 6,
1062 ],
1063 ],
1064 'selectors' => [
1065 '{{WRAPPER}} .ehp-form' => '--ehp-form-column-gap: {{SIZE}}{{UNIT}};',
1066 ],
1067 ]
1068 );
1069
1070 $this->add_control(
1071 'row_gap',
1072 [
1073 'label' => esc_html__( 'Rows Gap', 'hello-plus' ),
1074 'type' => Controls_Manager::SLIDER,
1075 'size_units' => [ 'px', 'em', 'rem', 'custom' ],
1076 'default' => [
1077 'size' => 32,
1078 'unit' => 'px',
1079 ],
1080 'range' => [
1081 'px' => [
1082 'max' => 60,
1083 ],
1084 'em' => [
1085 'max' => 6,
1086 ],
1087 'rem' => [
1088 'max' => 6,
1089 ],
1090 ],
1091 'selectors' => [
1092 '{{WRAPPER}} .ehp-form' => '--ehp-form-row-gap: {{SIZE}}{{UNIT}};',
1093 ],
1094 ]
1095 );
1096
1097 $this->add_control(
1098 'heading_label',
1099 [
1100 'label' => esc_html__( 'Label', 'hello-plus' ),
1101 'type' => Controls_Manager::HEADING,
1102 'separator' => 'before',
1103 ]
1104 );
1105
1106 $this->add_control(
1107 'label_spacing',
1108 [
1109 'label' => esc_html__( 'Spacing', 'hello-plus' ),
1110 'type' => Controls_Manager::SLIDER,
1111 'size_units' => [ 'px', 'em', 'rem', 'custom' ],
1112 'default' => [
1113 'size' => 0,
1114 'unit' => 'px',
1115 ],
1116 'range' => [
1117 'px' => [
1118 'max' => 60,
1119 ],
1120 'em' => [
1121 'max' => 6,
1122 ],
1123 'rem' => [
1124 'max' => 6,
1125 ],
1126 ],
1127 'selectors' => [
1128 '{{WRAPPER}} .ehp-form' => '--ehp-form-label-spacing: {{SIZE}}{{UNIT}};',
1129 ],
1130 ]
1131 );
1132
1133 $this->add_control(
1134 'label_color',
1135 [
1136 'label' => esc_html__( 'Text Color', 'hello-plus' ),
1137 'type' => Controls_Manager::COLOR,
1138 'selectors' => [
1139 '{{WRAPPER}} .ehp-form' => '--ehp-form-label-color: {{VALUE}};',
1140 ],
1141 'global' => [
1142 'default' => Global_Colors::COLOR_TEXT,
1143 ],
1144 ]
1145 );
1146
1147 $this->add_control(
1148 'mark_required_color',
1149 [
1150 'label' => esc_html__( 'Mark Color', 'hello-plus' ),
1151 'type' => Controls_Manager::COLOR,
1152 'default' => '#FF0000',
1153 'selectors' => [
1154 '{{WRAPPER}} .ehp-form' => '--ehp-form-mark-color: {{VALUE}};',
1155 ],
1156 'condition' => [
1157 'mark_required' => 'yes',
1158 ],
1159 ]
1160 );
1161
1162 $this->add_group_control(
1163 Group_Control_Typography::get_type(),
1164 [
1165 'name' => 'label_typography',
1166 'selector' => '{{WRAPPER}} .ehp-form__field-label',
1167 'global' => [
1168 'default' => Global_Typography::TYPOGRAPHY_TEXT,
1169 ],
1170 ]
1171 );
1172
1173 $this->end_controls_section();
1174 }
1175
1176 protected function add_style_fields_section(): void {
1177 $this->start_controls_section(
1178 'section_field_style',
1179 [
1180 'label' => esc_html__( 'Fields', 'hello-plus' ),
1181 'tab' => Controls_Manager::TAB_STYLE,
1182 ]
1183 );
1184
1185 $this->add_control(
1186 'input_size',
1187 [
1188 'label' => esc_html__( 'Input Size', 'hello-plus' ),
1189 'type' => Controls_Manager::SELECT,
1190 'options' => [
1191 'xs' => esc_html__( 'Extra Small', 'hello-plus' ),
1192 'sm' => esc_html__( 'Small', 'hello-plus' ),
1193 'md' => esc_html__( 'Medium', 'hello-plus' ),
1194 'lg' => esc_html__( 'Large', 'hello-plus' ),
1195 'xl' => esc_html__( 'Extra Large', 'hello-plus' ),
1196 ],
1197 'default' => 'sm',
1198 'separator' => 'after',
1199 ]
1200 );
1201
1202 $this->add_control(
1203 'field_text_color',
1204 [
1205 'label' => esc_html__( 'Text Color', 'hello-plus' ),
1206 'type' => Controls_Manager::COLOR,
1207 'selectors' => [
1208 '{{WRAPPER}} .ehp-form' => '--ehp-form-field-text-color: {{VALUE}};',
1209 ],
1210 'global' => [
1211 'default' => Global_Colors::COLOR_TEXT,
1212 ],
1213 ]
1214 );
1215
1216 $this->add_group_control(
1217 Group_Control_Typography::get_type(),
1218 [
1219 'name' => 'field_typography',
1220 'selector' => '{{WRAPPER}} .ehp-form__field, {{WRAPPER}} .ehp-form__field::placeholder',
1221 'global' => [
1222 'default' => Global_Typography::TYPOGRAPHY_TEXT,
1223 ],
1224 ]
1225 );
1226
1227 $this->add_control(
1228 'field_background_color',
1229 [
1230 'label' => esc_html__( 'Background Color', 'hello-plus' ),
1231 'type' => Controls_Manager::COLOR,
1232 'default' => '#ffffff',
1233 'selectors' => [
1234 '{{WRAPPER}} .ehp-form' => '--ehp-form-field-bg-color: {{VALUE}};',
1235 ],
1236 'separator' => 'before',
1237 ]
1238 );
1239
1240 $this->add_control(
1241 'field_border_switcher',
1242 [
1243 'label' => esc_html__( 'Border', 'hello-plus' ),
1244 'type' => Controls_Manager::SWITCHER,
1245 'options' => [
1246 'yes' => esc_html__( 'Yes', 'hello-plus' ),
1247 'no' => esc_html__( 'No', 'hello-plus' ),
1248 ],
1249 'default' => 'yes',
1250 'separator' => 'before',
1251 ]
1252 );
1253
1254 $this->add_control(
1255 'field_border_width',
1256 [
1257 'label' => esc_html__( 'Border Width', 'hello-plus' ),
1258 'type' => Controls_Manager::SLIDER,
1259 'size_units' => [ 'px', 'em', 'rem', 'custom' ],
1260 'range' => [
1261 'px' => [
1262 'max' => 100,
1263 ],
1264 'em' => [
1265 'max' => 10,
1266 ],
1267 'rem' => [
1268 'max' => 10,
1269 ],
1270 ],
1271 'default' => [
1272 'size' => 2,
1273 'unit' => 'px',
1274 ],
1275 'selectors' => [
1276 '{{WRAPPER}} .ehp-form' => '--ehp-form-field-border-width: {{SIZE}}{{UNIT}};',
1277 ],
1278 'condition' => [
1279 'field_border_switcher' => 'yes',
1280 ],
1281 ]
1282 );
1283
1284 $this->add_control(
1285 'field_border_color',
1286 [
1287 'label' => esc_html__( 'Border Color', 'hello-plus' ),
1288 'type' => Controls_Manager::COLOR,
1289 'selectors' => [
1290 '{{WRAPPER}} .ehp-form' => '--ehp-form-field-border-color: {{VALUE}};',
1291 ],
1292 'global' => [
1293 'default' => Global_Colors::COLOR_SECONDARY,
1294 ],
1295 'separator' => 'before',
1296 'condition' => [
1297 'field_border_switcher' => 'yes',
1298 ],
1299 ]
1300 );
1301
1302 $this->add_control(
1303 'fields_shape',
1304 [
1305 'label' => esc_html__( 'Shape', 'hello-plus' ),
1306 'type' => Controls_Manager::SELECT,
1307 'options' => [
1308 'default' => 'Default',
1309 'sharp' => 'Sharp',
1310 'rounded' => 'Rounded',
1311 'round' => 'Round',
1312 ],
1313 'default' => 'default',
1314 ]
1315 );
1316
1317 $this->end_controls_section();
1318 }
1319
1320 protected function add_style_buttons_section(): void {
1321 $this->start_controls_section(
1322 'section_button_style',
1323 [
1324 'label' => esc_html__( 'Button', 'hello-plus' ),
1325 'tab' => Controls_Manager::TAB_STYLE,
1326 ]
1327 );
1328
1329 $this->add_control(
1330 'button_type',
1331 [
1332 'label' => esc_html__( 'Type', 'hello-plus' ),
1333 'type' => Controls_Manager::SELECT,
1334 'options' => [
1335 'button' => esc_html__( 'Button', 'hello-plus' ),
1336 'link' => esc_html__( 'Link', 'hello-plus' ),
1337 ],
1338 'default' => 'button',
1339 ]
1340 );
1341
1342 $this->add_responsive_control(
1343 'button_align',
1344 [
1345 'label' => esc_html__( 'Position', 'hello-plus' ),
1346 'type' => Controls_Manager::CHOOSE,
1347 'options' => [
1348 'flex-start' => [
1349 'title' => esc_html__( 'Start', 'hello-plus' ),
1350 'icon' => 'eicon-h-align-left',
1351 ],
1352 'center' => [
1353 'title' => esc_html__( 'Center', 'hello-plus' ),
1354 'icon' => 'eicon-h-align-center',
1355 ],
1356 'flex-end' => [
1357 'title' => esc_html__( 'End', 'hello-plus' ),
1358 'icon' => 'eicon-h-align-right',
1359 ],
1360 ],
1361 'default' => 'center',
1362 'selectors' => [
1363 '{{WRAPPER}} .ehp-form' => '--ehp-form-button-align: {{VALUE}};',
1364 ],
1365 'condition' => [
1366 'button_width!' => '100',
1367 ],
1368 ]
1369 );
1370
1371 $this->add_group_control(
1372 Group_Control_Typography::get_type(),
1373 [
1374 'name' => 'button_typography',
1375 'global' => [
1376 'default' => Global_Typography::TYPOGRAPHY_ACCENT,
1377 ],
1378 'selector' => '{{WRAPPER}} .ehp-form__button',
1379 ]
1380 );
1381
1382 $start = is_rtl() ? 'right' : 'left';
1383 $end = is_rtl() ? 'left' : 'right';
1384
1385 $this->add_control(
1386 'button_icon_align',
1387 [
1388 'label' => esc_html__( 'Icon Position', 'hello-plus' ),
1389 'type' => Controls_Manager::CHOOSE,
1390 'default' => is_rtl() ? 'row-reverse' : 'row',
1391 'options' => [
1392 'row' => [
1393 'title' => esc_html__( 'Start', 'hello-plus' ),
1394 'icon' => "eicon-h-align-{$start}",
1395 ],
1396 'row-reverse' => [
1397 'title' => esc_html__( 'End', 'hello-plus' ),
1398 'icon' => "eicon-h-align-{$end}",
1399 ],
1400 ],
1401 'selectors_dictionary' => [
1402 'left' => is_rtl() ? 'row-reverse' : 'row',
1403 'right' => is_rtl() ? 'row' : 'row-reverse',
1404 ],
1405 'selectors' => [
1406 '{{WRAPPER}} .ehp-form' => '--ehp-form-button-icon-position: {{VALUE}};',
1407 ],
1408 'condition' => [
1409 'selected_button_icon[value]!' => '',
1410 ],
1411 ]
1412 );
1413
1414 $this->add_control(
1415 'button_icon_indent',
1416 [
1417 'label' => esc_html__( 'Icon Spacing', 'hello-plus' ),
1418 'type' => Controls_Manager::SLIDER,
1419 'size_units' => [ 'px', 'em', 'rem', 'custom' ],
1420 'range' => [
1421 'px' => [
1422 'max' => 100,
1423 ],
1424 'em' => [
1425 'max' => 10,
1426 ],
1427 'rem' => [
1428 'max' => 10,
1429 ],
1430 ],
1431 'default' => [
1432 'size' => 8,
1433 'unit' => 'px',
1434 ],
1435 'condition' => [
1436 'selected_button_icon[value]!' => '',
1437 ],
1438 'selectors' => [
1439 '{{WRAPPER}} .ehp-form' => '--ehp-form-button-icon-spacing: {{SIZE}}{{UNIT}};',
1440 ],
1441 ]
1442 );
1443
1444 $this->start_controls_tabs( 'tabs_button_style' );
1445
1446 $this->start_controls_tab(
1447 'tab_button_normal',
1448 [
1449 'label' => esc_html__( 'Normal', 'hello-plus' ),
1450 ]
1451 );
1452
1453 $this->add_control(
1454 'button_text_color',
1455 [
1456 'label' => esc_html__( 'Text Color', 'hello-plus' ),
1457 'type' => Controls_Manager::COLOR,
1458 'global' => [
1459 'default' => Global_Colors::COLOR_SECONDARY,
1460 ],
1461 'selectors' => [
1462 '{{WRAPPER}} .ehp-form' => '--ehp-form-button-text-color: {{VALUE}};',
1463 ],
1464 ]
1465 );
1466
1467 $this->add_group_control(
1468 Group_Control_Background::get_type(),
1469 [
1470 'name' => 'button_background',
1471 'types' => [ 'classic', 'gradient' ],
1472 'exclude' => [ 'image' ],
1473 'selector' => '{{WRAPPER}} .is-type-button.ehp-form__button',
1474 'fields_options' => [
1475 'background' => [
1476 'default' => 'classic',
1477 ],
1478 'color' => [
1479 'global' => [
1480 'default' => Global_Colors::COLOR_ACCENT,
1481 ],
1482 ],
1483 ],
1484 'condition' => [
1485 'button_type' => 'button',
1486 ],
1487 ]
1488 );
1489
1490 $this->end_controls_tab();
1491
1492 $this->start_controls_tab(
1493 'tab_button_hover',
1494 [
1495 'label' => esc_html__( 'Hover', 'hello-plus' ),
1496 ]
1497 );
1498
1499 $this->add_control(
1500 'button_text_color_hover',
1501 [
1502 'label' => esc_html__( 'Text Color', 'hello-plus' ),
1503 'type' => Controls_Manager::COLOR,
1504 'global' => [
1505 'default' => Global_Colors::COLOR_TEXT,
1506 ],
1507 'selectors' => [
1508 '{{WRAPPER}} .ehp-form' => '--ehp-form-button-text-color-hover: {{VALUE}};',
1509 ],
1510 ]
1511 );
1512
1513 $this->add_group_control(
1514 Group_Control_Background::get_type(),
1515 [
1516 'name' => 'button_background_hover',
1517 'types' => [ 'classic', 'gradient' ],
1518 'exclude' => [ 'image' ],
1519 'selector' => '{{WRAPPER}} .is-type-button.ehp-form__button:hover, {{WRAPPER}} .is-type-button.ehp-form__button:focus',
1520 'fields_options' => [
1521 'background' => [
1522 'default' => 'classic',
1523 ],
1524 'color' => [
1525 'global' => [
1526 'default' => Global_Colors::COLOR_ACCENT,
1527 ],
1528 ],
1529 ],
1530 'condition' => [
1531 'button_type' => 'button',
1532 ],
1533 ]
1534 );
1535
1536 $this->add_control(
1537 'button_hover_animation',
1538 [
1539 'label' => esc_html__( 'Animation', 'hello-plus' ),
1540 'type' => Controls_Manager::HOVER_ANIMATION,
1541 ]
1542 );
1543
1544 $this->end_controls_tab();
1545
1546 $this->end_controls_tabs();
1547
1548 $this->add_control(
1549 'button_border_switcher',
1550 [
1551 'label' => esc_html__( 'Border', 'hello-plus' ),
1552 'type' => Controls_Manager::SWITCHER,
1553 'options' => [
1554 'yes' => esc_html__( 'Yes', 'hello-plus' ),
1555 'no' => esc_html__( 'No', 'hello-plus' ),
1556 ],
1557 'default' => '',
1558 'separator' => 'before',
1559 ]
1560 );
1561
1562 $this->add_control(
1563 'button_border_width',
1564 [
1565 'label' => esc_html__( 'Border Width', 'hello-plus' ),
1566 'type' => Controls_Manager::SLIDER,
1567 'size_units' => [ 'px', 'em', 'rem', 'custom' ],
1568 'range' => [
1569 'px' => [
1570 'max' => 100,
1571 ],
1572 'em' => [
1573 'max' => 10,
1574 ],
1575 'rem' => [
1576 'max' => 10,
1577 ],
1578 ],
1579 'default' => [
1580 'size' => 2,
1581 'unit' => 'px',
1582 ],
1583 'selectors' => [
1584 '{{WRAPPER}} .ehp-form' => '--ehp-form-button-border-width: {{SIZE}}{{UNIT}};',
1585 ],
1586 'condition' => [
1587 'button_border_switcher' => 'yes',
1588 ],
1589 ]
1590 );
1591
1592 $this->add_control(
1593 'button_border_color',
1594 [
1595 'label' => esc_html__( 'Border Color', 'hello-plus' ),
1596 'type' => Controls_Manager::COLOR,
1597 'global' => [
1598 'default' => Global_Colors::COLOR_TEXT,
1599 ],
1600 'selectors' => [
1601 '{{WRAPPER}} .ehp-form' => '--ehp-form-button-border-color: {{VALUE}};',
1602 ],
1603 'condition' => [
1604 'button_border_switcher' => 'yes',
1605 ],
1606 ]
1607 );
1608
1609 $this->add_control(
1610 'button_shape',
1611 [
1612 'label' => esc_html__( 'Shape', 'hello-plus' ),
1613 'type' => Controls_Manager::SELECT,
1614 'options' => [
1615 'default' => 'Default',
1616 'sharp' => 'Sharp',
1617 'rounded' => 'Rounded',
1618 'round' => 'Round',
1619 ],
1620 'default' => 'default',
1621 ]
1622 );
1623
1624 $this->add_responsive_control(
1625 'button_text_padding',
1626 [
1627 'label' => esc_html__( 'Padding', 'hello-plus' ),
1628 'type' => Controls_Manager::DIMENSIONS,
1629 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
1630 'default' => [
1631 'top' => '8',
1632 'right' => '40',
1633 'bottom' => '8',
1634 'left' => '40',
1635 'unit' => 'px',
1636 ],
1637 'mobile_default' => [
1638 'top' => '8',
1639 'right' => '40',
1640 'bottom' => '8',
1641 'left' => '40',
1642 'unit' => 'px',
1643 ],
1644 'tablet_default' => [
1645 'top' => '8',
1646 'right' => '40',
1647 'bottom' => '8',
1648 'left' => '40',
1649 'unit' => 'px',
1650 ],
1651 'selectors' => [
1652 '{{WRAPPER}} .ehp-form' => '--ehp-form-button-padding-block-end: {{BOTTOM}}{{UNIT}}; --ehp-form-button-padding-block-start: {{TOP}}{{UNIT}}; --ehp-form-button-padding-inline-end: {{RIGHT}}{{UNIT}}; --ehp-form-button-padding-inline-start: {{LEFT}}{{UNIT}};',
1653 ],
1654 'separator' => 'before',
1655 ]
1656 );
1657
1658 $this->end_controls_section();
1659 }
1660
1661 protected function add_style_messages_section(): void {
1662 $this->start_controls_section(
1663 'section_messages_style',
1664 [
1665 'label' => esc_html__( 'Messages', 'hello-plus' ),
1666 'tab' => Controls_Manager::TAB_STYLE,
1667 ]
1668 );
1669
1670 $this->add_group_control(
1671 Group_Control_Typography::get_type(),
1672 [
1673 'name' => 'message_typography',
1674 'global' => [
1675 'default' => Global_Typography::TYPOGRAPHY_TEXT,
1676 ],
1677 'selector' => '{{WRAPPER}} .elementor-message',
1678 ]
1679 );
1680
1681 $this->add_control(
1682 'success_message_color',
1683 [
1684 'label' => esc_html__( 'Success Message Color', 'hello-plus' ),
1685 'type' => Controls_Manager::COLOR,
1686 'selectors' => [
1687 '{{WRAPPER}} .elementor-message.elementor-message-success' => 'color: {{COLOR}};',
1688 ],
1689 ]
1690 );
1691
1692 $this->add_control(
1693 'error_message_color',
1694 [
1695 'label' => esc_html__( 'Error Message Color', 'hello-plus' ),
1696 'type' => Controls_Manager::COLOR,
1697 'selectors' => [
1698 '{{WRAPPER}} .elementor-message.elementor-message-danger' => 'color: {{COLOR}};',
1699 ],
1700 ]
1701 );
1702
1703 $this->add_control(
1704 'inline_message_color',
1705 [
1706 'label' => esc_html__( 'Inline Message Color', 'hello-plus' ),
1707 'type' => Controls_Manager::COLOR,
1708 'selectors' => [
1709 '{{WRAPPER}} .elementor-message.elementor-help-inline' => 'color: {{COLOR}};',
1710 ],
1711 ]
1712 );
1713
1714 $this->end_controls_section();
1715 }
1716
1717 protected function add_style_box_section(): void {
1718 $this->start_controls_section(
1719 'section_box_style',
1720 [
1721 'label' => esc_html__( 'Box', 'hello-plus' ),
1722 'tab' => Controls_Manager::TAB_STYLE,
1723 ]
1724 );
1725
1726 $this->add_control(
1727 'box_heading',
1728 [
1729 'label' => esc_html__( 'Background', 'hello-plus' ),
1730 'type' => Controls_Manager::HEADING,
1731 ]
1732 );
1733
1734 $this->add_group_control(
1735 Group_Control_Background::get_type(),
1736 [
1737 'name' => 'box_background',
1738 'types' => [ 'classic', 'gradient' ],
1739 'exclude' => [ 'image' ],
1740 'selector' => '{{WRAPPER}} .ehp-form',
1741 'fields_options' => [
1742 'background' => [
1743 'default' => 'classic',
1744 ],
1745 ],
1746 ]
1747 );
1748
1749 $this->add_responsive_control(
1750 'content_width',
1751 [
1752 'label' => esc_html__( 'Content Width', 'hello-plus' ),
1753 'type' => Controls_Manager::SLIDER,
1754 'size_units' => [ 'px', 'em', 'rem', '%', 'custom' ],
1755 'range' => [
1756 'px' => [
1757 'max' => 1600,
1758 ],
1759 '%' => [
1760 'max' => 100,
1761 ],
1762 ],
1763 'default' => [
1764 'size' => 640,
1765 'unit' => 'px',
1766 ],
1767 'tablet_default' => [
1768 'size' => 640,
1769 'unit' => 'px',
1770 ],
1771 'mobile_default' => [
1772 'size' => 320,
1773 'unit' => 'px',
1774 ],
1775 'selectors' => [
1776 '{{WRAPPER}} .ehp-form' => '--ehp-form-content-width: {{SIZE}}{{UNIT}};',
1777 ],
1778 'separator' => 'before',
1779 ]
1780 );
1781
1782 $this->add_responsive_control(
1783 'box_padding',
1784 [
1785 'label' => esc_html__( 'Padding', 'hello-plus' ),
1786 'type' => Controls_Manager::DIMENSIONS,
1787 'size_units' => [ 'px', '%', 'em', 'rem' ],
1788 'selectors' => [
1789 '{{WRAPPER}} .ehp-form' => '--ehp-form-box-padding-block-end: {{BOTTOM}}{{UNIT}}; --ehp-form-box-padding-block-start: {{TOP}}{{UNIT}}; --ehp-form-box-padding-inline-end: {{RIGHT}}{{UNIT}}; --ehp-form-box-padding-inline-start: {{LEFT}}{{UNIT}};',
1790 ],
1791 'default' => [
1792 'top' => '60',
1793 'right' => '60',
1794 'bottom' => '60',
1795 'left' => '60',
1796 'unit' => 'px',
1797 ],
1798 'separator' => 'before',
1799 ]
1800 );
1801
1802 $this->end_controls_section();
1803 }
1804 }
1805