PluginProbe
The Innovative Form Builder – IvyForms / 0.7
The Innovative Form Builder – IvyForms v0.7
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.7, at backend/src/Services/Template/WeddingRsvpTemplate.php

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