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 / WeddingRsvpTemplate.php

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

298 lines 10.2 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 WeddingRsvpTemplate
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' => 'wedding_rsvp',
18 'name' => BackendStrings::getTemplateStrings()['wedding_rsvp'],
19 'description' => BackendStrings::getTemplateStrings()['wedding_rsvp_desc'],
20 'category' => 'event-registration-forms',
21 'subcategory' => 'wedding-forms',
22 'is_pro' => false,
23 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'wedding-rsvp.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()['wedding_rsvp'],
39 'published' => 1,
40 'showTitle' => 1,
41 'storeEntries' => 1,
42 'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(),
43 'fields' => array_merge(
44 self::getGuestInformationFields(),
45 self::getAttendanceFields(),
46 self::getMealPreferenceFields(),
47 self::getSpecialRequestFields()
48 ),
49 'settings' => []
50 ]
51 ]
52 );
53 }
54
55 /**
56 * Get guest information fields
57 *
58 * @return array<int, array<string, mixed>>
59 */
60 private static function getGuestInformationFields(): array
61 {
62 return [
63 // Name Field - Parent
64 [
65 'id' => 1,
66 'fieldIndex' => 1,
67 'type' => 'name',
68 'label' => BackendStrings::getTemplateStrings()['full_name'],
69 'parentId' => null,
70 'defaultValue' => '',
71 'placeholder' => '',
72 'required' => true,
73 'readonly' => false,
74 'position' => 1,
75 ],
76 // First Name - Child of Name Field
77 [
78 'id' => 2,
79 'type' => 'text',
80 'label' => BackendStrings::getNewFormStrings()['first_name'],
81 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_first_name'],
82 'required' => true,
83 'parentId' => 1,
84 'fieldIndex' => 1,
85 'defaultValue' => '',
86 'position' => 1,
87 'optionHide' => false,
88 'description' => '',
89 'settings' => json_encode(['nameFieldType' => 'nameField1']),
90 ],
91 // Last Name - Child of Name Field
92 [
93 'id' => 3,
94 'type' => 'text',
95 'label' => BackendStrings::getNewFormStrings()['last_name'],
96 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_last_name'],
97 'required' => true,
98 'parentId' => 1,
99 'fieldIndex' => 1,
100 'defaultValue' => '',
101 'position' => 2,
102 'optionHide' => false,
103 'description' => '',
104 'settings' => json_encode(['nameFieldType' => 'nameField2']),
105 ],
106 // Email
107 [
108 'id' => 4,
109 'fieldIndex' => 2,
110 'type' => 'email',
111 'label' => BackendStrings::getTemplateStrings()['email_address'],
112 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_email_address'],
113 'required' => true,
114 'parentId' => null,
115 'defaultValue' => '',
116 'position' => 2,
117 ],
118 // Phone
119 [
120 'id' => 5,
121 'fieldIndex' => 3,
122 'type' => 'phone',
123 'label' => BackendStrings::getTemplateStrings()['phone_number'],
124 'placeholder' => '+1 (_) _-_',
125 'required' => false,
126 'parentId' => null,
127 'defaultValue' => '',
128 'position' => 3,
129 'phoneAutoDetect' => true,
130 ],
131 ];
132 }
133
134 /**
135 * Get attendance fields
136 *
137 * @return array<int, array<string, mixed>>
138 */
139 private static function getAttendanceFields(): array
140 {
141 return [
142 [
143 'id' => 8,
144 'fieldIndex' => 4,
145 'type' => 'radio',
146 'label' => BackendStrings::getTemplateStrings()['will_you_attend'],
147 'required' => true,
148 'parentId' => null,
149 'defaultValue' => '',
150 'placeholder' => '',
151 'position' => 4,
152 'fieldOptions' => [
153 [
154 'id' => 6,
155 'label' => BackendStrings::getTemplateStrings()['yes_i_will_attend'],
156 'value' => 'yes',
157 'isDefault' => false,
158 'position' => 1
159 ],
160 [
161 'id' => 7,
162 'label' => BackendStrings::getTemplateStrings()['no_i_cannot_attend'],
163 'value' => 'no',
164 'isDefault' => false,
165 'position' => 2
166 ],
167 ]
168 ],
169 [
170 'id' => 9,
171 'fieldIndex' => 5,
172 'type' => 'number',
173 'label' => BackendStrings::getTemplateStrings()['number_of_guests'],
174 'placeholder' => BackendStrings::getTemplateStrings()['enter_total_attending_with_you'],
175 'required' => true,
176 'parentId' => null,
177 'position' => 5,
178 'minValue' => 1,
179 'maxValue' => 100,
180 ],
181 ];
182 }
183
184 /**
185 * Get meal preference fields
186 *
187 * @return array<int, array<string, mixed>>
188 */
189 private static function getMealPreferenceFields(): array
190 {
191 return [
192 [
193 'id' => 14,
194 'fieldIndex' => 6,
195 'type' => 'select',
196 'label' => BackendStrings::getTemplateStrings()['meal_option'],
197 'placeholder' => BackendStrings::getTemplateStrings()['select_your_meal_preference'],
198 'required' => false,
199 'parentId' => null,
200 'defaultValue' => '',
201 'position' => 6,
202 'fieldOptions' => [
203 [
204 'id' => 10,
205 'label' => BackendStrings::getTemplateStrings()['chicken'],
206 'value' => 'chicken',
207 'isDefault' => false,
208 'position' => 1
209 ],
210 [
211 'id' => 11,
212 'label' => BackendStrings::getTemplateStrings()['beef'],
213 'value' => 'beef',
214 'isDefault' => false,
215 'position' => 2
216 ],
217 [
218 'id' => 12,
219 'label' => BackendStrings::getTemplateStrings()['vegetarian'],
220 'value' => 'vegetarian',
221 'isDefault' => false,
222 'position' => 3
223 ],
224 [
225 'id' => 13,
226 'label' => BackendStrings::getTemplateStrings()['vegan'],
227 'value' => 'vegan',
228 'isDefault' => false,
229 'position' => 4
230 ],
231 ]
232 ],
233 [
234 'id' => 15,
235 'fieldIndex' => 7,
236 'type' => 'textarea',
237 'label' => BackendStrings::getTemplateStrings()['dietary_restrictions_allergies'],
238 'placeholder' => BackendStrings::getTemplateStrings()['dietary_restrictions_placeholder'],
239 'required' => false,
240 'parentId' => null,
241 'defaultValue' => '',
242 'position' => 7,
243 'rows' => 3,
244 ],
245 ];
246 }
247
248 /**
249 * Get special request fields
250 *
251 * @return array<int, array<string, mixed>>
252 */
253 private static function getSpecialRequestFields(): array
254 {
255 return [
256 [
257 'id' => 16,
258 'fieldIndex' => 8,
259 'type' => 'textarea',
260 'label' => BackendStrings::getTemplateStrings()['song_request_message_for_couple'],
261 'placeholder' => BackendStrings::getTemplateStrings()['song_request_placeholder'],
262 'required' => false,
263 'parentId' => null,
264 'defaultValue' => '',
265 'position' => 8,
266 'rows' => 3,
267 ],
268 [
269 'id' => 19,
270 'fieldIndex' => 9,
271 'type' => 'radio',
272 'label' => BackendStrings::getTemplateStrings()['require_special_assistance'],
273 'required' => false,
274 'parentId' => null,
275 'defaultValue' => '',
276 'placeholder' => '',
277 'position' => 9,
278 'fieldOptions' => [
279 [
280 'id' => 17,
281 'label' => BackendStrings::getTemplateStrings()['yes'],
282 'value' => 'yes',
283 'isDefault' => false,
284 'position' => 1
285 ],
286 [
287 'id' => 18,
288 'label' => BackendStrings::getTemplateStrings()['no'],
289 'value' => 'no',
290 'isDefault' => false,
291 'position' => 2
292 ],
293 ]
294 ],
295 ];
296 }
297 }
298