PluginProbe
The Innovative Form Builder – IvyForms / 1.0
The Innovative Form Builder – IvyForms v1.0
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 / WeddingRegistrationFormTemplate.php

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

249 lines 8.7 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 WeddingRegistrationFormTemplate
8 {
9 /**
10 * Wedding Registration Form Template
11 */
12 /**
13 * Get template metadata (without form_data)
14 *
15 * @return array<string, mixed>
16 */
17 public static function getTemplateMeta(): array
18 {
19 return [
20 'id' => 'wedding_registration_form',
21 'name' => BackendStrings::getTemplateStrings()['wedding_registration_form'],
22 'description' => BackendStrings::getTemplateStrings()[
23 'wedding_registration_form_description'
24 ],
25 'category' => 'event-registration-forms',
26 'subcategory' => 'wedding-forms',
27 'is_pro' => false,
28 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'wedding-registration-form.svg'
29 ];
30 }
31
32 /**
33 * Get the full template including form data
34 *
35 * @return array<string, mixed>
36 */
37 public static function getTemplate(): array
38 {
39 return array_merge(
40 self::getTemplateMeta(),
41 [
42 'form_data' => [
43 'name' => BackendStrings::getTemplateStrings()['wedding_registration_form'],
44 'published' => 1,
45 'showTitle' => 1,
46 'storeEntries' => 1,
47 'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(),
48 'fields' => array_merge(
49 self::getPersonalInformationFields(),
50 self::getGuestFields(),
51 self::getAdditionalInformationFields()
52 ),
53 'settings' => []
54 ]
55 ]
56 );
57 }
58
59 /**
60 * Personal information fields (name, email)
61 *
62 * @return array<int, array<string, mixed>>
63 */
64 private static function getPersonalInformationFields(): array
65 {
66 return [
67 // Full Name
68 [
69 'id' => 1,
70 'fieldIndex' => 1,
71 'type' => 'name',
72 'label' => BackendStrings::getTemplateStrings()['full_name'],
73 'parentId' => null,
74 'defaultValue' => '',
75 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_full_name'],
76 'required' => true,
77 'readonly' => false,
78 'position' => 1,
79 ],
80 // First Name - Child of Name Field
81 [
82 'id' => 2,
83 'type' => 'text',
84 'label' => BackendStrings::getTemplateStrings()['first_name'],
85 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_first_name'],
86 'required' => true,
87 'parentId' => 1,
88 'fieldIndex' => 1,
89 'defaultValue' => '',
90 'position' => 1,
91 'optionHide' => false,
92 'description' => '',
93 'settings' => json_encode(['nameFieldType' => 'nameField1']),
94 ],
95 // Last Name - Child of Name Field
96 [
97 'id' => 3,
98 'type' => 'text',
99 'label' => BackendStrings::getTemplateStrings()['last_name'],
100 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_last_name'],
101 'required' => true,
102 'parentId' => 1,
103 'fieldIndex' => 1,
104 'defaultValue' => '',
105 'position' => 2,
106 'optionHide' => false,
107 'description' => '',
108 'settings' => json_encode(['nameFieldType' => 'nameField2']),
109 ],
110 // Email Address
111 [
112 'id' => 4,
113 'fieldIndex' => 2,
114 'type' => 'email',
115 'label' => BackendStrings::getTemplateStrings()['email_address'],
116 'placeholder' => BackendStrings::getTemplateStrings()['email_placeholder'],
117 'required' => true,
118 'parentId' => null,
119 'defaultValue' => '',
120 'position' => 3,
121 ],
122 ];
123 }
124
125 /**
126 * Guest fields (number of guests, meal preference)
127 *
128 * @return array<int, array<string, mixed>>
129 */
130 private static function getGuestFields(): array
131 {
132 return [
133 // Number of Guests
134 [
135 'id' => 5,
136 'fieldIndex' => 3,
137 'type' => 'number',
138 'label' => BackendStrings::getTemplateStrings()['number_of_guests'],
139 'placeholder' => BackendStrings::getTemplateStrings()['enter_number_of_guests'],
140 'required' => true,
141 'parentId' => null,
142 'defaultValue' => '',
143 'position' => 4,
144 'minValue' => 1,
145 ],
146 // Meal Preference
147 [
148 'id' => 10,
149 'fieldIndex' => 4,
150 'type' => 'select',
151 'label' => BackendStrings::getTemplateStrings()['meal_preference'],
152 'placeholder' => BackendStrings::getTemplateStrings()['select_meal_preference'],
153 'required' => false,
154 'parentId' => null,
155 'defaultValue' => '',
156 'position' => 5,
157 'fieldOptions' => [
158 [
159 'id' => 6,
160 'label' => BackendStrings::getTemplateStrings()['vegetarian'],
161 'value' => 'vegetarian',
162 'isDefault' => false,
163 'position' => 1
164 ],
165 [
166 'id' => 7,
167 'label' => BackendStrings::getTemplateStrings()['non_vegetarian'],
168 'value' => 'non_vegetarian',
169 'isDefault' => false,
170 'position' => 2
171 ],
172 [
173 'id' => 8,
174 'label' => BackendStrings::getTemplateStrings()['vegan'],
175 'value' => 'vegan',
176 'isDefault' => false,
177 'position' => 3
178 ],
179 [
180 'id' => 9,
181 'label' => BackendStrings::getTemplateStrings()['kids_menu'],
182 'value' => 'kids_menu',
183 'isDefault' => false,
184 'position' => 4
185 ],
186 ]
187 ],
188 ];
189 }
190
191 /**
192 * Additional information fields (message to couple)
193 *
194 * @return array<int, array<string, mixed>>
195 */
196 private static function getAdditionalInformationFields(): array
197 {
198 return [
199 // Special Requests
200 [
201 'id' => 14,
202 'fieldIndex' => 5,
203 'type' => 'checkbox',
204 'label' => BackendStrings::getTemplateStrings()['special_requests'],
205 'placeholder' => '',
206 'required' => false,
207 'parentId' => null,
208 'defaultValue' => '',
209 'position' => 6,
210 'fieldOptions' => [
211 [
212 'id' => 11,
213 'label' => BackendStrings::getTemplateStrings()['wheelchair_access'],
214 'value' => 'wheelchair_access',
215 'isDefault' => false,
216 'position' => 1
217 ],
218 [
219 'id' => 12,
220 'label' => BackendStrings::getTemplateStrings()['allergy_information'],
221 'value' => 'allergy_information',
222 'isDefault' => false,
223 'position' => 2
224 ],
225 [
226 'id' => 13,
227 'label' => BackendStrings::getTemplateStrings()['other'],
228 'value' => 'other',
229 'isDefault' => false,
230 'position' => 3
231 ],
232 ]
233 ],
234 // Message to the Couple
235 [
236 'id' => 15,
237 'fieldIndex' => 6,
238 'type' => 'textarea',
239 'label' => BackendStrings::getTemplateStrings()['message_to_the_couple'],
240 'placeholder' => BackendStrings::getTemplateStrings()['write_your_message_or_wishes_here'],
241 'required' => false,
242 'parentId' => null,
243 'defaultValue' => '',
244 'position' => 6,
245 ],
246 ];
247 }
248 }
249