PluginProbe
Hello Plus / 1.4.0
Hello Plus v1.4.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.4.0, at modules/forms/widgets/ehp-form.php

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