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

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

289 lines 10.0 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 WeddingRsvpTemplate
13 {
14 /**
15 * Get the wedding RSVP form template
16 *
17 * @return array<string, mixed>
18 */
19 public static function getTemplate(): array
20 {
21 return [
22 'id' => 'wedding_rsvp',
23 'name' => BackendStrings::getTemplateStrings()['wedding_rsvp'],
24 'description' => BackendStrings::getTemplateStrings()['wedding_rsvp_desc'],
25 'category' => 'event-registration-forms',
26 'subcategory' => 'wedding-forms',
27 'is_pro' => false,
28 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'wedding-rsvp.svg',
29 'form_data' => [
30 'name' => BackendStrings::getTemplateStrings()['wedding_rsvp'],
31 'published' => 1,
32 'showTitle' => 1,
33 'storeEntries' => 1,
34 'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(),
35 'fields' => array_merge(
36 self::getGuestInformationFields(),
37 self::getAttendanceFields(),
38 self::getMealPreferenceFields(),
39 self::getSpecialRequestFields()
40 ),
41 'settings' => []
42 ]
43 ];
44 }
45
46 /**
47 * Get guest information fields
48 *
49 * @return array<int, array<string, mixed>>
50 */
51 private static function getGuestInformationFields(): array
52 {
53 return [
54 // Name Field - Parent
55 [
56 'id' => 1,
57 'fieldIndex' => 1,
58 'type' => 'name',
59 'label' => BackendStrings::getTemplateStrings()['full_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
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
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 attendance fields
127 *
128 * @return array<int, array<string, mixed>>
129 */
130 private static function getAttendanceFields(): array
131 {
132 return [
133 [
134 'id' => 8,
135 'fieldIndex' => 4,
136 'type' => 'radio',
137 'label' => BackendStrings::getTemplateStrings()['will_you_attend'],
138 'required' => true,
139 'parentId' => null,
140 'defaultValue' => '',
141 'placeholder' => '',
142 'position' => 4,
143 'fieldOptions' => [
144 [
145 'id' => 6,
146 'label' => BackendStrings::getTemplateStrings()['yes_i_will_attend'],
147 'value' => 'yes',
148 'isDefault' => false,
149 'position' => 1
150 ],
151 [
152 'id' => 7,
153 'label' => BackendStrings::getTemplateStrings()['no_i_cannot_attend'],
154 'value' => 'no',
155 'isDefault' => false,
156 'position' => 2
157 ],
158 ]
159 ],
160 [
161 'id' => 9,
162 'fieldIndex' => 5,
163 'type' => 'number',
164 'label' => BackendStrings::getTemplateStrings()['number_of_guests'],
165 'placeholder' => BackendStrings::getTemplateStrings()['enter_total_attending_with_you'],
166 'required' => true,
167 'parentId' => null,
168 'position' => 5,
169 'minValue' => 1,
170 'maxValue' => 100,
171 ],
172 ];
173 }
174
175 /**
176 * Get meal preference fields
177 *
178 * @return array<int, array<string, mixed>>
179 */
180 private static function getMealPreferenceFields(): array
181 {
182 return [
183 [
184 'id' => 14,
185 'fieldIndex' => 6,
186 'type' => 'select',
187 'label' => BackendStrings::getTemplateStrings()['meal_option'],
188 'placeholder' => BackendStrings::getTemplateStrings()['select_your_meal_preference'],
189 'required' => false,
190 'parentId' => null,
191 'defaultValue' => '',
192 'position' => 6,
193 'fieldOptions' => [
194 [
195 'id' => 10,
196 'label' => BackendStrings::getTemplateStrings()['chicken'],
197 'value' => 'chicken',
198 'isDefault' => false,
199 'position' => 1
200 ],
201 [
202 'id' => 11,
203 'label' => BackendStrings::getTemplateStrings()['beef'],
204 'value' => 'beef',
205 'isDefault' => false,
206 'position' => 2
207 ],
208 [
209 'id' => 12,
210 'label' => BackendStrings::getTemplateStrings()['vegetarian'],
211 'value' => 'vegetarian',
212 'isDefault' => false,
213 'position' => 3
214 ],
215 [
216 'id' => 13,
217 'label' => BackendStrings::getTemplateStrings()['vegan'],
218 'value' => 'vegan',
219 'isDefault' => false,
220 'position' => 4
221 ],
222 ]
223 ],
224 [
225 'id' => 15,
226 'fieldIndex' => 7,
227 'type' => 'textarea',
228 'label' => BackendStrings::getTemplateStrings()['dietary_restrictions_allergies'],
229 'placeholder' => BackendStrings::getTemplateStrings()['dietary_restrictions_placeholder'],
230 'required' => false,
231 'parentId' => null,
232 'defaultValue' => '',
233 'position' => 7,
234 'rows' => 3,
235 ],
236 ];
237 }
238
239 /**
240 * Get special request fields
241 *
242 * @return array<int, array<string, mixed>>
243 */
244 private static function getSpecialRequestFields(): array
245 {
246 return [
247 [
248 'id' => 16,
249 'fieldIndex' => 8,
250 'type' => 'textarea',
251 'label' => BackendStrings::getTemplateStrings()['song_request_message_for_couple'],
252 'placeholder' => BackendStrings::getTemplateStrings()['song_request_placeholder'],
253 'required' => false,
254 'parentId' => null,
255 'defaultValue' => '',
256 'position' => 8,
257 'rows' => 3,
258 ],
259 [
260 'id' => 19,
261 'fieldIndex' => 9,
262 'type' => 'radio',
263 'label' => BackendStrings::getTemplateStrings()['require_special_assistance'],
264 'required' => false,
265 'parentId' => null,
266 'defaultValue' => '',
267 'placeholder' => '',
268 'position' => 9,
269 'fieldOptions' => [
270 [
271 'id' => 17,
272 'label' => BackendStrings::getTemplateStrings()['yes'],
273 'value' => 'yes',
274 'isDefault' => false,
275 'position' => 1
276 ],
277 [
278 'id' => 18,
279 'label' => BackendStrings::getTemplateStrings()['no'],
280 'value' => 'no',
281 'isDefault' => false,
282 'position' => 2
283 ],
284 ]
285 ],
286 ];
287 }
288 }
289