PluginProbe
The Innovative Form Builder – IvyForms / 1.1.1
The Innovative Form Builder – IvyForms v1.1.1
1.5.1 1.5 1.4.1 1.4 trunk 0.1.2 0.2 0.2.1 0.3 0.3.1 0.4 0.5 0.6 0.6.1 0.6.1-backup 0.6.1.1 0.7 0.8 0.8.1 0.8.2 0.9 0.9.1 1.0 1.1 1.1.1 All 27 releases
ivyforms / backend / src / Services / Template / ContactFormTemplate.php

ContactFormTemplate.php in The Innovative Form Builder – IvyForms 1.1.1, at backend/src/Services/Template/ContactFormTemplate.php

140 lines 5.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace IvyForms\Services\Template;
4
5 use IvyForms\Services\Translations\BackendStrings;
6
7 class ContactFormTemplate
8 {
9 /**
10 * Get template metadata (without form_data)
11 *
12 * @return array<string, mixed>
13 */
14 public static function getTemplateMeta(): array
15 {
16 return [
17 'id' => 'contact_form',
18 'name' => BackendStrings::getTemplateStrings()['contact_form'],
19 'description' => BackendStrings::getTemplateStrings()['contact_form_desc'],
20 'category' => 'contact-forms',
21 'subcategory' => 'emergency-contact-forms',
22 'is_pro' => false,
23 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'contact-form.svg'
24 ];
25 }
26
27 /**
28 * Get the full template including form data
29 *
30 * @return array<string, mixed>
31 */
32 public static function getTemplate(): array
33 {
34 return array_merge(
35 self::getTemplateMeta(),
36 [
37 'form_data' => [
38 'name' => BackendStrings::getTemplateStrings()['contact_form'],
39 'published' => 1,
40 'showTitle' => 1,
41 'storeEntries' => 1,
42 'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(),
43 'fields' => [
44 // Name Field - Parent
45 [
46 'id' => 1,
47 'fieldIndex' => 1,
48 'type' => 'name',
49 'label' => BackendStrings::getTemplateStrings()['full_name'],
50 'parentId' => null,
51 'defaultValue' => '',
52 'placeholder' => '',
53 'required' => true,
54 'readonly' => false,
55 'position' => 1,
56 ],
57 // First Name - Child of Name Field
58 [
59 'id' => 2,
60 'type' => 'text',
61 'label' => BackendStrings::getTemplateStrings()['first_name'],
62 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_first_name'],
63 'required' => true,
64 'parentId' => 1,
65 'fieldIndex' => 1,
66 'defaultValue' => '',
67 'position' => 1,
68 'optionHide' => false,
69 'description' => '',
70 'settings' => json_encode(['nameFieldType' => 'nameField1']),
71 ],
72 // Last Name - Child of Name Field
73 [
74 'id' => 3,
75 'type' => 'text',
76 'label' => BackendStrings::getTemplateStrings()['last_name'],
77 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_last_name'],
78 'required' => true,
79 'parentId' => 1,
80 'fieldIndex' => 1,
81 'defaultValue' => '',
82 'position' => 2,
83 'optionHide' => false,
84 'description' => '',
85 'settings' => json_encode(['nameFieldType' => 'nameField2']),
86 ],
87 [
88 'id' => 4,
89 'fieldIndex' => 2,
90 'type' => 'email',
91 'label' => BackendStrings::getTemplateStrings()['email_address'],
92 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_email_address'],
93 'required' => true,
94 'validation' => [
95 'required' => true,
96 'email' => true
97 ],
98 'settings' => [
99 'css_class' => 'ivyforms-field-email'
100 ],
101 'position' => 2,
102 ],
103 [
104 'id' => 5,
105 'fieldIndex' => 3,
106 'type' => 'text',
107 'label' => BackendStrings::getTemplateStrings()['subject'],
108 'placeholder' => BackendStrings::getTemplateStrings()['what_is_this_regarding'],
109 'required' => false,
110 'validation' => [
111 'required' => false,
112 ],
113 'settings' => [
114 'css_class' => 'ivyforms-field-subject'
115 ],
116 'position' => 3,
117 ],
118 [
119 'id' => 6,
120 'fieldIndex' => 4,
121 'type' => 'textarea',
122 'label' => BackendStrings::getTemplateStrings()['message'],
123 'placeholder' => BackendStrings::getTemplateStrings()['please_enter_your_message_here'],
124 'required' => false,
125 'validation' => [
126 'required' => false,
127 ],
128 'settings' => [
129 'css_class' => 'ivyforms-field-message'
130 ],
131 'position' => 4,
132 ]
133 ],
134 'settings' => []
135 ]
136 ]
137 );
138 }
139 }
140