PluginProbe
The Innovative Form Builder – IvyForms / 0.9
The Innovative Form Builder – IvyForms v0.9
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 / EventTShirtOrderFormTemplate.php

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

348 lines 12.4 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 class EventTShirtOrderFormTemplate
13 {
14 /**
15 * Get the event t-shirt order form template
16 *
17 * @return array<string, mixed>
18 */
19 public static function getTemplate(): array
20 {
21 return [
22 'id' => 'event_tshirt_order_form',
23 'name' => BackendStrings::getTemplateStrings()['event_tshirt_order_form'],
24 'description' => BackendStrings::getTemplateStrings()['event_tshirt_order_form_desc'],
25 'category' => 'order-forms',
26 'subcategory' => 'tshirt-order-forms',
27 'is_pro' => false,
28 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'event-tshirt-order-form.svg',
29 'form_data' => [
30 'name' => BackendStrings::getTemplateStrings()['event_tshirt_order_form'],
31 'published' => 1,
32 'showTitle' => 1,
33 'storeEntries' => 1,
34 'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(),
35 'fields' => array_merge(
36 self::getRequestorInformationFields(),
37 self::getEventDetailsFields(),
38 self::getTShirtDetailsFields(),
39 self::getAdditionalOptionsFields()
40 ),
41 'settings' => []
42 ]
43 ];
44 }
45
46 /**
47 * Get requestor information fields
48 *
49 * @return array<int, array<string, mixed>>
50 */
51 private static function getRequestorInformationFields(): array
52 {
53 return [
54 // Name Field - Parent
55 [
56 'id' => 1,
57 'fieldIndex' => 1,
58 'type' => 'name',
59 'label' => BackendStrings::getTemplateStrings()['requestor_name'],
60 'parentId' => null,
61 'defaultValue' => '',
62 'placeholder' => '',
63 'required' => true,
64 'readonly' => false,
65 'position' => 1,
66 ],
67 // First Name - Child of Name Field
68 [
69 'id' => 2,
70 'type' => 'text',
71 'label' => BackendStrings::getNewFormStrings()['first_name'],
72 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_first_name'],
73 'required' => true,
74 'parentId' => 1,
75 'fieldIndex' => 1,
76 'defaultValue' => '',
77 'position' => 1,
78 'optionHide' => false,
79 'description' => '',
80 'settings' => json_encode(['nameFieldType' => 'nameField1']),
81 ],
82 // Last Name - Child of Name Field
83 [
84 'id' => 3,
85 'type' => 'text',
86 'label' => BackendStrings::getNewFormStrings()['last_name'],
87 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_last_name'],
88 'required' => true,
89 'parentId' => 1,
90 'fieldIndex' => 1,
91 'defaultValue' => '',
92 'position' => 2,
93 'optionHide' => false,
94 'description' => '',
95 'settings' => json_encode(['nameFieldType' => 'nameField2']),
96 ],
97 // Email Address
98 [
99 'id' => 4,
100 'fieldIndex' => 2,
101 'type' => 'email',
102 'label' => BackendStrings::getTemplateStrings()['email_address'],
103 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_email_address'],
104 'required' => true,
105 'parentId' => null,
106 'defaultValue' => '',
107 'position' => 2,
108 ],
109 // Phone Number
110 [
111 'id' => 5,
112 'fieldIndex' => 3,
113 'type' => 'phone',
114 'label' => BackendStrings::getTemplateStrings()['phone_number'],
115 'placeholder' => '+1 (_) _-_',
116 'required' => false,
117 'parentId' => null,
118 'defaultValue' => '',
119 'position' => 3,
120 'phoneAutoDetect' => true,
121 ],
122 ];
123 }
124
125 /**
126 * Get event details fields
127 *
128 * @return array<int, array<string, mixed>>
129 */
130 private static function getEventDetailsFields(): array
131 {
132 return [
133 // Event Name
134 [
135 'id' => 6,
136 'fieldIndex' => 4,
137 'type' => 'text',
138 'label' => BackendStrings::getTemplateStrings()['event_name'],
139 'placeholder' => BackendStrings::getTemplateStrings()['enter_event_name'],
140 'required' => true,
141 'parentId' => null,
142 'defaultValue' => '',
143 'position' => 4,
144 ],
145 ];
146 }
147
148 /**
149 * Get t-shirt details fields
150 *
151 * @return array<int, array<string, mixed>>
152 */
153 private static function getTShirtDetailsFields(): array
154 {
155 return [
156 // T-Shirt Size
157 [
158 'id' => 13,
159 'fieldIndex' => 5,
160 'type' => 'select',
161 'label' => BackendStrings::getTemplateStrings()['tshirt_size'],
162 'placeholder' => BackendStrings::getTemplateStrings()['select_tshirt_size'],
163 'required' => true,
164 'parentId' => null,
165 'defaultValue' => '',
166 'position' => 5,
167 'fieldOptions' => [
168 [
169 'id' => 7,
170 'label' => BackendStrings::getTemplateStrings()['xs'],
171 'value' => 'xs',
172 'isDefault' => false,
173 'position' => 1
174 ],
175 [
176 'id' => 8,
177 'label' => BackendStrings::getTemplateStrings()['s'],
178 'value' => 's',
179 'isDefault' => false,
180 'position' => 2
181 ],
182 [
183 'id' => 9,
184 'label' => BackendStrings::getTemplateStrings()['m'],
185 'value' => 'm',
186 'isDefault' => false,
187 'position' => 3
188 ],
189 [
190 'id' => 10,
191 'label' => BackendStrings::getTemplateStrings()['l'],
192 'value' => 'l',
193 'isDefault' => false,
194 'position' => 4
195 ],
196 [
197 'id' => 11,
198 'label' => BackendStrings::getTemplateStrings()['xl'],
199 'value' => 'xl',
200 'isDefault' => false,
201 'position' => 5
202 ],
203 [
204 'id' => 12,
205 'label' => BackendStrings::getTemplateStrings()['xxl'],
206 'value' => 'xxl',
207 'isDefault' => false,
208 'position' => 6
209 ],
210 ]
211 ],
212 // Quantity
213 [
214 'id' => 14,
215 'fieldIndex' => 6,
216 'type' => 'number',
217 'label' => BackendStrings::getTemplateStrings()['quantity'],
218 'placeholder' => BackendStrings::getTemplateStrings()['enter_quantity'],
219 'required' => true,
220 'parentId' => null,
221 'position' => 6,
222 'minValue' => 1,
223 'maxValue' => 100,
224 ],
225 // Event Notes or Special Instructions
226 [
227 'id' => 15,
228 'fieldIndex' => 7,
229 'type' => 'textarea',
230 'label' => BackendStrings::getTemplateStrings()['event_notes_special_instructions'],
231 'placeholder' => BackendStrings::getTemplateStrings()['enter_event_notes'],
232 'parentId' => null,
233 'defaultValue' => '',
234 'position' => 7,
235 'required' => false,
236 'rows' => 3,
237 ],
238 // T-Shirt Color
239 [
240 'id' => 22,
241 'fieldIndex' => 8,
242 'type' => 'select',
243 'label' => BackendStrings::getTemplateStrings()['tshirt_color'],
244 'placeholder' => BackendStrings::getTemplateStrings()['select_tshirt_color'],
245 'required' => true,
246 'parentId' => null,
247 'defaultValue' => '',
248 'position' => 8,
249 'fieldOptions' => [
250 [
251 'id' => 16,
252 'label' => BackendStrings::getTemplateStrings()['white'],
253 'value' => 'white',
254 'isDefault' => false,
255 'position' => 1
256 ],
257 [
258 'id' => 17,
259 'label' => BackendStrings::getTemplateStrings()['black'],
260 'value' => 'black',
261 'isDefault' => false,
262 'position' => 2
263 ],
264 [
265 'id' => 18,
266 'label' => BackendStrings::getTemplateStrings()['red'],
267 'value' => 'red',
268 'isDefault' => false,
269 'position' => 3
270 ],
271 [
272 'id' => 19,
273 'label' => BackendStrings::getTemplateStrings()['blue'],
274 'value' => 'blue',
275 'isDefault' => false,
276 'position' => 4
277 ],
278 [
279 'id' => 20,
280 'label' => BackendStrings::getTemplateStrings()['green'],
281 'value' => 'green',
282 'isDefault' => false,
283 'position' => 5
284 ],
285 [
286 'id' => 21,
287 'label' => BackendStrings::getTemplateStrings()['custom'],
288 'value' => 'custom',
289 'isDefault' => false,
290 'position' => 6
291 ],
292 ]
293 ],
294 ];
295 }
296
297 /**
298 * Get additional options fields
299 *
300 * @return array<int, array<string, mixed>>
301 */
302 private static function getAdditionalOptionsFields(): array
303 {
304 return [
305 // Include Event Logo
306 [
307 'id' => 25,
308 'fieldIndex' => 9,
309 'type' => 'radio',
310 'label' => BackendStrings::getTemplateStrings()['include_event_logo'],
311 'parentId' => null,
312 'position' => 9,
313 'required' => false,
314 'fieldOptions' => [
315 [
316 'id' => 23,
317 'label' => BackendStrings::getTemplateStrings()['yes'],
318 'value' => 'yes',
319 'isDefault' => false,
320 'position' => 1
321 ],
322 [
323 'id' => 24,
324 'label' => BackendStrings::getTemplateStrings()['no'],
325 'value' => 'no',
326 'isDefault' => false,
327 'position' => 2
328 ],
329 ]
330 ],
331 // Event Date - moved to last position
332 [
333 'id' => 26,
334 'fieldIndex' => 10,
335 'type' => 'date',
336 'label' => BackendStrings::getTemplateStrings()['event_date'],
337 'placeholder' => BackendStrings::getTemplateStrings()['select_event_date'],
338 'required' => true,
339 'parentId' => null,
340 'defaultValue' => '',
341 'position' => 10,
342 'dateFieldType' => 'picker',
343 'dateFormat' => 'MM/DD/YYYY',
344 ],
345 ];
346 }
347 }
348