PluginProbe
The Innovative Form Builder – IvyForms / 0.8.1
The Innovative Form Builder – IvyForms v0.8.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 / BeachWeddingRSVPFormTemplate.php

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

395 lines 14.3 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 // phpcs:disable PSR1.Files.SideEffects
6 if (!defined('ABSPATH')) {
7 exit; // Exit if accessed directly
8 }
9
10 use IvyForms\Services\Translations\BackendStrings;
11
12 /**
13 * Beach Wedding RSVP Form Template
14 */
15 class BeachWeddingRSVPFormTemplate
16 {
17 /**
18 * Get the template configuration
19 *
20 * @return array<string, mixed>
21 */
22 public static function getTemplate(): array
23 {
24 return [
25 'id' => 'beach_wedding_rsvp_form',
26 'name' => BackendStrings::getTemplateStrings()['beach_wedding_rsvp_form'],
27 'description' => BackendStrings::getTemplateStrings()[
28 'beach_wedding_rsvp_form_description'
29 ],
30 'category' => 'event-registration-forms',
31 'subcategory' => 'wedding-forms',
32 'is_pro' => false,
33 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'beach-wedding-rsvp-form.svg',
34 'form_data' => [
35 'name' => BackendStrings::getTemplateStrings()['beach_wedding_rsvp_form'],
36 'published' => 1,
37 'showTitle' => 1,
38 'storeEntries' => 1,
39 'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(),
40 'fields' => array_merge(
41 self::getPersonalInformationFields(),
42 self::getAttendanceFields(),
43 self::getMealPreferencesFields(),
44 self::getAdditionalInformationFields()
45 ),
46 'settings' => []
47 ]
48 ];
49 }
50
51 /**
52 * Personal information fields (name, email, phone, relationship)
53 *
54 * @return array<int, array<string, mixed>>
55 */
56 private static function getPersonalInformationFields(): array
57 {
58 return [
59 // Full Name
60 [
61 'id' => 0,
62 'fieldIndex' => 1,
63 'type' => 'name',
64 'label' => BackendStrings::getTemplateStrings()['full_name'],
65 'parentId' => null,
66 'defaultValue' => '',
67 'placeholder' => '',
68 'required' => true,
69 'readonly' => false,
70 'position' => 1,
71 ],
72 // First Name - Child of Name Field
73 [
74 'id' => 0,
75 'type' => 'text',
76 'label' => BackendStrings::getTemplateStrings()['first_name'],
77 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_first_name'],
78 'required' => true,
79 'parentId' => 0,
80 'fieldIndex' => 1,
81 'defaultValue' => '',
82 'position' => 1,
83 'optionHide' => false,
84 'description' => '',
85 'settings' => json_encode(['nameFieldType' => 'nameField1']),
86 ],
87 // Last Name - Child of Name Field
88 [
89 'id' => 0,
90 'type' => 'text',
91 'label' => BackendStrings::getTemplateStrings()['last_name'],
92 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_last_name'],
93 'required' => true,
94 'parentId' => 0,
95 'fieldIndex' => 1,
96 'defaultValue' => '',
97 'position' => 2,
98 'optionHide' => false,
99 'description' => '',
100 'settings' => json_encode(['nameFieldType' => 'nameField2']),
101 ],
102 // Email Address
103 [
104 'id' => 0,
105 'fieldIndex' => 2,
106 'type' => 'email',
107 'label' => BackendStrings::getTemplateStrings()['email_address'],
108 'placeholder' => BackendStrings::getTemplateStrings()['email_placeholder'],
109 'required' => true,
110 'parentId' => null,
111 'defaultValue' => '',
112 'position' => 3,
113 ],
114 // Phone Number
115 [
116 'id' => 0,
117 'fieldIndex' => 3,
118 'type' => 'phone',
119 'label' => BackendStrings::getTemplateStrings()['phone_number'],
120 'placeholder' => BackendStrings::getTemplateStrings()['phone_placeholder'],
121 'required' => false,
122 'parentId' => null,
123 'defaultValue' => '',
124 'position' => 4,
125 ],
126 // Relationship to Couple
127 [
128 'id' => 0,
129 'fieldIndex' => 4,
130 'type' => 'select',
131 'label' => BackendStrings::getTemplateStrings()['relationship_to_couple'],
132 'placeholder' => BackendStrings::getTemplateStrings()['select_relationship_to_couple'],
133 'required' => true,
134 'parentId' => null,
135 'defaultValue' => '',
136 'position' => 5,
137 'fieldOptions' => [
138 [
139 'id' => 0,
140 'label' => BackendStrings::getTemplateStrings()['family'],
141 'value' => 'family',
142 'isDefault' => false,
143 'position' => 1
144 ],
145 [
146 'id' => 0,
147 'label' => BackendStrings::getTemplateStrings()['friend'],
148 'value' => 'friend',
149 'isDefault' => false,
150 'position' => 2
151 ],
152 [
153 'id' => 0,
154 'label' => BackendStrings::getTemplateStrings()['colleague'],
155 'value' => 'colleague',
156 'isDefault' => false,
157 'position' => 3
158 ],
159 [
160 'id' => 0,
161 'label' => BackendStrings::getTemplateStrings()['other'],
162 'value' => 'other',
163 'isDefault' => false,
164 'position' => 4
165 ],
166 ]
167 ],
168 ];
169 }
170
171 /**
172 * Attendance fields (will you attend, number of guests, arrival date)
173 *
174 * @return array<int, array<string, mixed>>
175 */
176 private static function getAttendanceFields(): array
177 {
178 return [
179 // Will you attend?
180 [
181 'id' => 0,
182 'fieldIndex' => 5,
183 'type' => 'radio',
184 'label' => BackendStrings::getTemplateStrings()['will_you_attend'],
185 'placeholder' => '',
186 'required' => true,
187 'parentId' => null,
188 'defaultValue' => '',
189 'position' => 6,
190 'fieldOptions' => [
191 [
192 'id' => 0,
193 'label' => BackendStrings::getTemplateStrings()['yes'],
194 'value' => 'yes',
195 'isDefault' => false,
196 'position' => 1
197 ],
198 [
199 'id' => 0,
200 'label' => BackendStrings::getTemplateStrings()['no'],
201 'value' => 'no',
202 'isDefault' => false,
203 'position' => 2
204 ],
205 ]
206 ],
207 // Number of Guests
208 [
209 'id' => 0,
210 'fieldIndex' => 6,
211 'type' => 'number',
212 'label' => BackendStrings::getTemplateStrings()['number_of_guests'],
213 'placeholder' => BackendStrings::getTemplateStrings()['enter_number_of_attendees'],
214 'required' => true,
215 'parentId' => null,
216 'defaultValue' => '',
217 'position' => 7,
218 'minValue' => 1,
219 ],
220 // Arrival Date
221 [
222 'id' => 0,
223 'fieldIndex' => 7,
224 'type' => 'date',
225 'label' => BackendStrings::getTemplateStrings()['arrival_date'],
226 'placeholder' => BackendStrings::getTemplateStrings()['enter_arrival_date'],
227 'required' => false,
228 'parentId' => null,
229 'defaultValue' => '',
230 'position' => 8,
231 'dateFieldType' => 'picker',
232 'dateFormat' => 'MM/DD/YYYY',
233 ],
234 ];
235 }
236
237 /**
238 * Meal preferences fields (meal preference, dietary restrictions)
239 *
240 * @return array<int, array<string, mixed>>
241 */
242 private static function getMealPreferencesFields(): array
243 {
244 return [
245 // Meal Preference
246 [
247 'id' => 0,
248 'fieldIndex' => 8,
249 'type' => 'select',
250 'label' => BackendStrings::getTemplateStrings()['meal_preference'],
251 'placeholder' => BackendStrings::getTemplateStrings()['select_meal_preference'],
252 'required' => true,
253 'parentId' => null,
254 'defaultValue' => '',
255 'position' => 9,
256 'fieldOptions' => [
257 [
258 'id' => 0,
259 'label' => BackendStrings::getTemplateStrings()['beef'],
260 'value' => 'beef',
261 'isDefault' => false,
262 'position' => 1
263 ],
264 [
265 'id' => 0,
266 'label' => BackendStrings::getTemplateStrings()['chicken'],
267 'value' => 'chicken',
268 'isDefault' => false,
269 'position' => 2
270 ],
271 [
272 'id' => 0,
273 'label' => BackendStrings::getTemplateStrings()['fish'],
274 'value' => 'fish',
275 'isDefault' => false,
276 'position' => 3
277 ],
278 [
279 'id' => 0,
280 'label' => BackendStrings::getTemplateStrings()['vegetarian'],
281 'value' => 'vegetarian',
282 'isDefault' => false,
283 'position' => 4
284 ],
285 [
286 'id' => 0,
287 'label' => BackendStrings::getTemplateStrings()['vegan'],
288 'value' => 'vegan',
289 'isDefault' => false,
290 'position' => 5
291 ],
292 [
293 'id' => 0,
294 'label' => BackendStrings::getTemplateStrings()['other'],
295 'value' => 'other',
296 'isDefault' => false,
297 'position' => 6
298 ],
299 ]
300 ],
301 // Dietary Restrictions or Notes
302 [
303 'id' => 0,
304 'fieldIndex' => 9,
305 'type' => 'textarea',
306 'label' => BackendStrings::getTemplateStrings()['dietary_restrictions_or_notes'],
307 'placeholder' => BackendStrings::getTemplateStrings()['specify_allergies_or_special_requests'],
308 'required' => false,
309 'parentId' => null,
310 'defaultValue' => '',
311 'position' => 10,
312 ],
313 ];
314 }
315
316 /**
317 * Additional information fields (beach games, transportation, special messages)
318 *
319 * @return array<int, array<string, mixed>>
320 */
321 private static function getAdditionalInformationFields(): array
322 {
323 return [
324 // Participate in Beach Games?
325 [
326 'id' => 0,
327 'fieldIndex' => 10,
328 'type' => 'radio',
329 'label' => BackendStrings::getTemplateStrings()['participate_in_beach_games'],
330 'placeholder' => '',
331 'required' => false,
332 'parentId' => null,
333 'defaultValue' => '',
334 'position' => 11,
335 'fieldOptions' => [
336 [
337 'id' => 0,
338 'label' => BackendStrings::getTemplateStrings()['yes'],
339 'value' => 'yes',
340 'isDefault' => false,
341 'position' => 1
342 ],
343 [
344 'id' => 0,
345 'label' => BackendStrings::getTemplateStrings()['no'],
346 'value' => 'no',
347 'isDefault' => false,
348 'position' => 2
349 ],
350 ]
351 ],
352 // Need Transportation?
353 [
354 'id' => 0,
355 'fieldIndex' => 11,
356 'type' => 'radio',
357 'label' => BackendStrings::getTemplateStrings()['need_transportation'],
358 'placeholder' => '',
359 'required' => false,
360 'parentId' => null,
361 'defaultValue' => '',
362 'position' => 12,
363 'fieldOptions' => [
364 [
365 'id' => 0,
366 'label' => BackendStrings::getTemplateStrings()['yes'],
367 'value' => 'yes',
368 'isDefault' => false,
369 'position' => 1
370 ],
371 [
372 'id' => 0,
373 'label' => BackendStrings::getTemplateStrings()['no'],
374 'value' => 'no',
375 'isDefault' => false,
376 'position' => 2
377 ],
378 ]
379 ],
380 // Special Requests or Messages
381 [
382 'id' => 0,
383 'fieldIndex' => 12,
384 'type' => 'textarea',
385 'label' => BackendStrings::getTemplateStrings()['special_requests_or_messages'],
386 'placeholder' => BackendStrings::getTemplateStrings()['enter_any_additional_notes'],
387 'required' => false,
388 'parentId' => null,
389 'defaultValue' => '',
390 'position' => 13,
391 ],
392 ];
393 }
394 }
395