PluginProbe
The Innovative Form Builder – IvyForms / 1.5
The Innovative Form Builder – IvyForms v1.5
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 / EducationConferenceRegistrationFormTemplate.php

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

243 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 use IvyForms\Services\Translations\BackendStrings;
6
7 class EducationConferenceRegistrationFormTemplate
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' => 'education_conference_registration_form',
18 'name' => BackendStrings::getTemplateStrings()['education_conference_registration_form'],
19 'description' => BackendStrings::getTemplateStrings()['education_conference_registration_form_desc'],
20 'category' => 'event-registration-forms',
21 'subcategory' => 'conference-registration-forms',
22 'is_pro' => false,
23 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'education-conference-registration-form.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()['education_conference_registration_form'],
39 'published' => 1,
40 'showTitle' => 1,
41 'storeEntries' => 1,
42 'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(),
43 'fields' => array_merge(
44 self::getParticipantInformationFields(),
45 self::getConferencePreferencesFields(),
46 self::getAdditionalInformationFields()
47 ),
48 'settings' => []
49 ]
50 ]
51 );
52 }
53
54 /**
55 * Get participant information fields
56 *
57 * @return array<int, array<string, mixed>>
58 */
59 private static function getParticipantInformationFields(): array
60 {
61 return [
62 // Full Name
63 [
64 'id' => 1,
65 'fieldIndex' => 1,
66 'type' => 'text',
67 'label' => BackendStrings::getTemplateStrings()['full_name'],
68 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_full_name'],
69 'required' => true,
70 'parentId' => null,
71 'defaultValue' => '',
72 'position' => 1,
73 'validation' => [
74 'required' => true,
75 ],
76 ],
77 // Email Address
78 [
79 'id' => 2,
80 'fieldIndex' => 2,
81 'type' => 'email',
82 'label' => BackendStrings::getTemplateStrings()['email_address'],
83 'placeholder' => '[email protected]',
84 'required' => true,
85 'parentId' => null,
86 'defaultValue' => '',
87 'position' => 2,
88 'validation' => [
89 'required' => true,
90 'email' => true
91 ],
92 ],
93 ];
94 }
95
96 /**
97 * Get conference preferences fields
98 *
99 * @return array<int, array<string, mixed>>
100 */
101 private static function getConferencePreferencesFields(): array
102 {
103 return [
104 // Role Dropdown
105 [
106 'id' => 8,
107 'fieldIndex' => 3,
108 'type' => 'select',
109 'label' => BackendStrings::getTemplateStrings()['role'],
110 'placeholder' => BackendStrings::getTemplateStrings()['select_role'],
111 'required' => true,
112 'parentId' => null,
113 'defaultValue' => '',
114 'position' => 3,
115 'fieldOptions' => [
116 [
117 'id' => 3,
118 'label' => BackendStrings::getTemplateStrings()['teacher'],
119 'value' => 'teacher',
120 'isDefault' => false,
121 'position' => 1,
122 ],
123 [
124 'id' => 4,
125 'label' => BackendStrings::getTemplateStrings()['principal'],
126 'value' => 'principal',
127 'isDefault' => false,
128 'position' => 2,
129 ],
130 [
131 'id' => 5,
132 'label' => BackendStrings::getTemplateStrings()['researcher'],
133 'value' => 'researcher',
134 'isDefault' => false,
135 'position' => 3,
136 ],
137 [
138 'id' => 6,
139 'label' => BackendStrings::getTemplateStrings()['student'],
140 'value' => 'student',
141 'isDefault' => false,
142 'position' => 4,
143 ],
144 [
145 'id' => 7,
146 'label' => BackendStrings::getTemplateStrings()['other'],
147 'value' => 'other',
148 'isDefault' => false,
149 'position' => 5,
150 ],
151 ],
152 ],
153 // Sessions to Attend (Multidropdown)
154 [
155 'id' => 12,
156 'fieldIndex' => 4,
157 'type' => 'multi-select',
158 'label' => BackendStrings::getTemplateStrings()['sessions_to_attend'],
159 'placeholder' => BackendStrings::getTemplateStrings()['select_sessions'],
160 'required' => false,
161 'parentId' => null,
162 'defaultValue' => '',
163 'position' => 4,
164 'fieldOptions' => [
165 [
166 'id' => 9,
167 'label' => BackendStrings::getTemplateStrings()['session_1'],
168 'value' => 'session_1',
169 'isDefault' => false,
170 'position' => 1,
171 ],
172 [
173 'id' => 10,
174 'label' => BackendStrings::getTemplateStrings()['session_2'],
175 'value' => 'session_2',
176 'isDefault' => false,
177 'position' => 2,
178 ],
179 [
180 'id' => 11,
181 'label' => BackendStrings::getTemplateStrings()['session_3'],
182 'value' => 'session_3',
183 'isDefault' => false,
184 'position' => 3,
185 ],
186 ],
187 ],
188 // Participation Type (Radio)
189 [
190 'id' => 15,
191 'fieldIndex' => 5,
192 'type' => 'radio',
193 'label' => BackendStrings::getTemplateStrings()['participation_type'],
194 'placeholder' => '',
195 'required' => true,
196 'parentId' => null,
197 'defaultValue' => '',
198 'position' => 5,
199 'fieldOptions' => [
200 [
201 'id' => 13,
202 'label' => BackendStrings::getTemplateStrings()['in_person'],
203 'value' => 'in_person',
204 'isDefault' => false,
205 'position' => 1,
206 ],
207 [
208 'id' => 14,
209 'label' => BackendStrings::getTemplateStrings()['virtual'],
210 'value' => 'virtual',
211 'isDefault' => false,
212 'position' => 2,
213 ],
214 ],
215 ],
216 ];
217 }
218
219 /**
220 * Get additional information fields
221 *
222 * @return array<int, array<string, mixed>>
223 */
224 private static function getAdditionalInformationFields(): array
225 {
226 return [
227 // Questions or Comments
228 [
229 'id' => 16,
230 'fieldIndex' => 6,
231 'type' => 'textarea',
232 'label' => BackendStrings::getTemplateStrings()['questions_or_comments'],
233 'placeholder' => BackendStrings::getTemplateStrings()['write_questions_or_comments_for_organizers'],
234 'required' => false,
235 'parentId' => null,
236 'defaultValue' => '',
237 'position' => 6,
238 'rows' => 4,
239 ],
240 ];
241 }
242 }
243