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
← All changes | backend/src/Services/Template/MaternityLeaveRequestFormTemplate.php +41 -30 0.8.2 → 1.5 View file →
@@ -1,23 +1,18 @@
1 1 <?php
2 2
3 3 namespace IvyForms\Services\Template;
4 4
5 -// phpcs:disable PSR1.Files.SideEffects
6 -if (!defined('ABSPATH')) {
7 - exit; // Exit if accessed directly
8 -}
9 -
10 5 use IvyForms\Services\Translations\BackendStrings;
11 6
12 7 class MaternityLeaveRequestFormTemplate
13 8 {
14 9 /**
15 - * Get the maternity leave request form template
10 + * Get template metadata (without form_data)
16 11 *
17 12 * @return array<string, mixed>
18 13 */
19 - public static function getTemplate(): array
14 + public static function getTemplateMeta(): array
20 15 {
21 16 return [
22 17 'id' => 'maternity_leave_request_form',
23 18 'name' => BackendStrings::getTemplateStrings()['maternity_leave_request_form'],
@@ -24,9 +19,22 @@
24 19 'description' => BackendStrings::getTemplateStrings()['maternity_leave_request_form_desc'],
25 20 'category' => 'leave-request',
26 21 'subcategory' => 'leave-request-forms',
27 22 'is_pro' => false,
28 - 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'maternity-leave-request-form.svg',
23 + 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'maternity-leave-request-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 + [
29 37 'form_data' => [
30 38 'name' => BackendStrings::getTemplateStrings()['maternity_leave_request_form'],
31 39 'published' => 1,
32 40 'showTitle' => 1,
@@ -38,9 +46,10 @@
38 46 self::getNotificationFields()
39 47 ),
40 48 'settings' => []
41 49 ]
42 - ];
50 + ]
51 + );
43 52 }
44 53
45 54 /**
46 55 * Employee information fields
@@ -51,9 +60,9 @@
51 60 {
52 61 return [
53 62 // Name Field - Parent
54 63 [
55 - 'id' => 0,
64 + 'id' => 1,
56 65 'fieldIndex' => 1,
57 66 'type' => 'name',
58 67 'label' => BackendStrings::getTemplateStrings()['full_name'],
59 68 'parentId' => null,
@@ -64,14 +73,14 @@
64 73 'position' => 1,
65 74 ],
66 75 // First Name - Child
67 76 [
68 - 'id' => 0,
77 + 'id' => 2,
69 78 'type' => 'text',
70 79 'label' => BackendStrings::getNewFormStrings()['first_name'],
71 80 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_first_name'],
72 81 'required' => true,
73 - 'parentId' => 0,
82 + 'parentId' => 1,
74 83 'fieldIndex' => 1,
75 84 'defaultValue' => '',
76 85 'position' => 1,
77 86 'settings' => json_encode(['nameFieldType' => 'nameField1']),
@@ -77,14 +86,14 @@
77 86 'settings' => json_encode(['nameFieldType' => 'nameField1']),
78 87 ],
79 88 // Last Name - Child
80 89 [
81 - 'id' => 0,
90 + 'id' => 3,
82 91 'type' => 'text',
83 92 'label' => BackendStrings::getNewFormStrings()['last_name'],
84 93 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_last_name'],
85 94 'required' => true,
86 - 'parentId' => 0,
95 + 'parentId' => 1,
87 96 'fieldIndex' => 1,
88 97 'defaultValue' => '',
89 98 'position' => 2,
90 99 'settings' => json_encode(['nameFieldType' => 'nameField2']),
@@ -90,9 +99,9 @@
90 99 'settings' => json_encode(['nameFieldType' => 'nameField2']),
91 100 ],
92 101 // Email
93 102 [
94 - 'id' => 0,
103 + 'id' => 4,
95 104 'fieldIndex' => 2,
96 105 'type' => 'email',
97 106 'label' => BackendStrings::getTemplateStrings()['email_address'],
98 107 'placeholder' => BackendStrings::getTemplateStrings()['email_placeholder'],
@@ -102,9 +111,9 @@
102 111 'position' => 2,
103 112 ],
104 113 // Department select
105 114 [
106 - 'id' => 0,
115 + 'id' => 10,
107 116 'fieldIndex' => 3,
108 117 'type' => 'select',
109 118 'label' => BackendStrings::getTemplateStrings()['department'],
110 119 'placeholder' => BackendStrings::getTemplateStrings()['select_department'],
@@ -113,9 +122,9 @@
113 122 'defaultValue' => '',
114 123 'position' => 3,
115 124 'fieldOptions' => [
116 125 [
117 - 'id' => 0,
126 + 'id' => 5,
118 127 'label' => BackendStrings::getTemplateStrings()['hr'],
119 128 'value' => 'hr',
120 129 'isDefault' => false,
121 130 'position' => 1
@@ -120,21 +129,21 @@
120 129 'isDefault' => false,
121 130 'position' => 1
122 131 ],
123 132 [
124 - 'id' => 0,
133 + 'id' => 6,
125 134 'label' => BackendStrings::getTemplateStrings()['it'],
126 135 'value' => 'it',
127 136 'isDefault' => false,
128 137 'position' => 2],
129 138 [
130 - 'id' => 0,
139 + 'id' => 7,
131 140 'label' => BackendStrings::getTemplateStrings()['sales'],
132 141 'value' => 'sales',
133 142 'isDefault' => false,
134 143 'position' => 3],
135 144 [
136 - 'id' => 0,
145 + 'id' => 8,
137 146 'label' => BackendStrings::getTemplateStrings()['marketing'],
138 147 'value' => 'marketing',
139 148 'isDefault' => false,
140 149 'position' => 4
@@ -139,9 +148,9 @@
139 148 'isDefault' => false,
140 149 'position' => 4
141 150 ],
142 151 [
143 - 'id' => 0,
152 + 'id' => 9,
144 153 'label' => BackendStrings::getTemplateStrings()['other'],
145 154 'value' => 'other',
146 155 'isDefault' => false,
147 156 'position' => 5],
@@ -159,9 +168,9 @@
159 168 {
160 169 return [
161 170 // Leave Type (Maternity only)
162 171 [
163 - 'id' => 0,
172 + 'id' => 12,
164 173 'fieldIndex' => 4,
165 174 'type' => 'select',
166 175 'label' => BackendStrings::getTemplateStrings()['type_of_leave'],
167 176 'placeholder' => BackendStrings::getTemplateStrings()['select_type_of_leave'],
@@ -170,9 +179,9 @@
170 179 'defaultValue' => '',
171 180 'position' => 4,
172 181 'fieldOptions' => [
173 182 [
174 - 'id' => 0,
183 + 'id' => 11,
175 184 'label' => BackendStrings::getTemplateStrings()['maternity_leave'],
176 185 'value' => 'maternity_leave',
177 186 'isDefault' => false,
178 187 'position' => 1
@@ -180,9 +189,9 @@
180 189 ]
181 190 ],
182 191 // Start Date of Leave
183 192 [
184 - 'id' => 0,
193 + 'id' => 13,
185 194 'fieldIndex' => 5,
186 195 'type' => 'date',
187 196 'label' => BackendStrings::getTemplateStrings()['start_date_of_leave'],
188 197 'placeholder' => BackendStrings::getTemplateStrings()['select_start_date_of_leave'],
@@ -194,9 +203,9 @@
194 203 'dateFormat' => 'MM/DD/YYYY',
195 204 ],
196 205 // Expected Return Date
197 206 [
198 - 'id' => 0,
207 + 'id' => 14,
199 208 'fieldIndex' => 6,
200 209 'type' => 'date',
201 210 'label' => BackendStrings::getTemplateStrings()['expected_return_date'],
202 211 'placeholder' => BackendStrings::getTemplateStrings()['select_expected_return_date'],
@@ -208,9 +217,9 @@
208 217 'dateFormat' => 'MM/DD/YYYY',
209 218 ],
210 219 // Additional Notes
211 220 [
212 - 'id' => 0,
221 + 'id' => 15,
213 222 'fieldIndex' => 7,
214 223 'type' => 'textarea',
215 224 'label' => BackendStrings::getTemplateStrings()['additional_notes'],
216 225 'placeholder' => BackendStrings::getTemplateStrings()['additional_notes_placeholder'],
@@ -232,9 +241,9 @@
232 241 {
233 242 return [
234 243 // Notify my supervisor? checkbox
235 244 [
236 - 'id' => 0,
245 + 'id' => 18,
237 246 'fieldIndex' => 8,
238 247 'type' => 'checkbox',
239 248 'label' => BackendStrings::getTemplateStrings()['notify_my_supervisor'],
240 249 'parentId' => null,
@@ -242,18 +251,20 @@
242 251 'required' => false,
243 252 'defaultValue' => '',
244 253 'fieldOptions' => [
245 254 [
246 - 'id' => 0,
255 + 'id' => 16,
247 256 'label' => BackendStrings::getTemplateStrings()['notify_my_supervisor_yes'],
248 257 'value' => 'yes',
249 258 'isDefault' => false,
250 259 'position' => 1],
251 - ['id' => 0,
260 + [
261 + 'id' => 17,
252 262 'label' => BackendStrings::getTemplateStrings()['notify_my_supervisor_no'],
253 263 'value' => 'no',
254 264 'isDefault' => false,
255 - 'position' => 2],
265 + 'position' => 2
266 + ],
256 267 ]
257 268 ],
258 269 ];
259 270 }