PluginProbe
The Innovative Form Builder – IvyForms / 0.8.2
The Innovative Form Builder – IvyForms v0.8.2
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 / WeddingRegistrationFormTemplate.php

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

240 lines 8.5 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 * Wedding Registration Form Template
14 */
15 class WeddingRegistrationFormTemplate
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' => 'wedding_registration_form',
26 'name' => BackendStrings::getTemplateStrings()['wedding_registration_form'],
27 'description' => BackendStrings::getTemplateStrings()[
28 'wedding_registration_form_description'
29 ],
30 'category' => 'event-registration-forms',
31 'subcategory' => 'wedding-forms',
32 'is_pro' => false,
33 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'wedding-registration-form.svg',
34 'form_data' => [
35 'name' => BackendStrings::getTemplateStrings()['wedding_registration_form'],
36 'published' => 1,
37 'showTitle' => 1,
38 'storeEntries' => 1,
39 'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(),
40 'fields' => array_merge(
41 self::getPersonalInformationFields(),
42 self::getGuestFields(),
43 self::getAdditionalInformationFields()
44 ),
45 'settings' => []
46 ]
47 ];
48 }
49
50 /**
51 * Personal information fields (name, email)
52 *
53 * @return array<int, array<string, mixed>>
54 */
55 private static function getPersonalInformationFields(): array
56 {
57 return [
58 // Full Name
59 [
60 'id' => 0,
61 'fieldIndex' => 1,
62 'type' => 'name',
63 'label' => BackendStrings::getTemplateStrings()['full_name'],
64 'parentId' => null,
65 'defaultValue' => '',
66 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_full_name'],
67 'required' => true,
68 'readonly' => false,
69 'position' => 1,
70 ],
71 // First Name - Child of Name Field
72 [
73 'id' => 0,
74 'type' => 'text',
75 'label' => BackendStrings::getTemplateStrings()['first_name'],
76 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_first_name'],
77 'required' => true,
78 'parentId' => 0,
79 'fieldIndex' => 1,
80 'defaultValue' => '',
81 'position' => 1,
82 'optionHide' => false,
83 'description' => '',
84 'settings' => json_encode(['nameFieldType' => 'nameField1']),
85 ],
86 // Last Name - Child of Name Field
87 [
88 'id' => 0,
89 'type' => 'text',
90 'label' => BackendStrings::getTemplateStrings()['last_name'],
91 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_last_name'],
92 'required' => true,
93 'parentId' => 0,
94 'fieldIndex' => 1,
95 'defaultValue' => '',
96 'position' => 2,
97 'optionHide' => false,
98 'description' => '',
99 'settings' => json_encode(['nameFieldType' => 'nameField2']),
100 ],
101 // Email Address
102 [
103 'id' => 0,
104 'fieldIndex' => 2,
105 'type' => 'email',
106 'label' => BackendStrings::getTemplateStrings()['email_address'],
107 'placeholder' => BackendStrings::getTemplateStrings()['email_placeholder'],
108 'required' => true,
109 'parentId' => null,
110 'defaultValue' => '',
111 'position' => 3,
112 ],
113 ];
114 }
115
116 /**
117 * Guest fields (number of guests, meal preference)
118 *
119 * @return array<int, array<string, mixed>>
120 */
121 private static function getGuestFields(): array
122 {
123 return [
124 // Number of Guests
125 [
126 'id' => 0,
127 'fieldIndex' => 3,
128 'type' => 'number',
129 'label' => BackendStrings::getTemplateStrings()['number_of_guests'],
130 'placeholder' => BackendStrings::getTemplateStrings()['enter_number_of_guests'],
131 'required' => true,
132 'parentId' => null,
133 'defaultValue' => '',
134 'position' => 4,
135 'minValue' => 1,
136 ],
137 // Meal Preference
138 [
139 'id' => 0,
140 'fieldIndex' => 4,
141 'type' => 'select',
142 'label' => BackendStrings::getTemplateStrings()['meal_preference'],
143 'placeholder' => BackendStrings::getTemplateStrings()['select_meal_preference'],
144 'required' => false,
145 'parentId' => null,
146 'defaultValue' => '',
147 'position' => 5,
148 'fieldOptions' => [
149 [
150 'id' => 0,
151 'label' => BackendStrings::getTemplateStrings()['vegetarian'],
152 'value' => 'vegetarian',
153 'isDefault' => false,
154 'position' => 1
155 ],
156 [
157 'id' => 0,
158 'label' => BackendStrings::getTemplateStrings()['non_vegetarian'],
159 'value' => 'non_vegetarian',
160 'isDefault' => false,
161 'position' => 2
162 ],
163 [
164 'id' => 0,
165 'label' => BackendStrings::getTemplateStrings()['vegan'],
166 'value' => 'vegan',
167 'isDefault' => false,
168 'position' => 3
169 ],
170 [
171 'id' => 0,
172 'label' => BackendStrings::getTemplateStrings()['kids_menu'],
173 'value' => 'kids_menu',
174 'isDefault' => false,
175 'position' => 4
176 ],
177 ]
178 ],
179 ];
180 }
181
182 /**
183 * Additional information fields (message to couple)
184 *
185 * @return array<int, array<string, mixed>>
186 */
187 private static function getAdditionalInformationFields(): array
188 {
189 return [
190 // Special Requests
191 [
192 'id' => 0,
193 'fieldIndex' => 5,
194 'type' => 'checkbox',
195 'label' => BackendStrings::getTemplateStrings()['special_requests'],
196 'placeholder' => '',
197 'required' => false,
198 'parentId' => null,
199 'defaultValue' => '',
200 'position' => 6,
201 'fieldOptions' => [
202 [
203 'id' => 0,
204 'label' => BackendStrings::getTemplateStrings()['wheelchair_access'],
205 'value' => 'wheelchair_access',
206 'isDefault' => false,
207 'position' => 1
208 ],
209 [
210 'id' => 0,
211 'label' => BackendStrings::getTemplateStrings()['allergy_information'],
212 'value' => 'allergy_information',
213 'isDefault' => false,
214 'position' => 2
215 ],
216 [
217 'id' => 0,
218 'label' => BackendStrings::getTemplateStrings()['other'],
219 'value' => 'other',
220 'isDefault' => false,
221 'position' => 3
222 ],
223 ]
224 ],
225 // Message to the Couple
226 [
227 'id' => 0,
228 'fieldIndex' => 6,
229 'type' => 'textarea',
230 'label' => BackendStrings::getTemplateStrings()['message_to_the_couple'],
231 'placeholder' => BackendStrings::getTemplateStrings()['write_your_message_or_wishes_here'],
232 'required' => false,
233 'parentId' => null,
234 'defaultValue' => '',
235 'position' => 6,
236 ],
237 ];
238 }
239 }
240