PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / trunk
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder vtrunk
V-3.3.0 3.2.2 3.2.1 3.2.0 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 V3.0.3 V3.0.2 -3.0.1 V_3.0.0 1.1.1 1.1.8 1.2 1.3 1.4 1.4.18 1.5.2 1.9 2.0 2.10.0 2.10.1 2.10.2 All 137 releases
bit-form / includes / Admin / Form / ScriptFilePriorityManager.php

ScriptFilePriorityManager.php in Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder trunk, at includes/Admin/Form/ScriptFilePriorityManager.php

525 lines 25.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace BitCode\BitForm\Admin\Form;
4
5 class ScriptFilePriorityManager
6 {
7 public static function jsFile()
8 {
9 /**
10 * file load priority
11 * first priority status code 100
12 * sub status code link 101,102
13 * second priority status code 200
14 * sub status code link 201,202, 203
15 * continue..........
16 * priority = 100 range for helper file
17 * priority = 200 range for field file
18 * priority = 300 range for script file
19 * priority = 400 range for custom script file
20 * priority = 500 range for js init for custom field file
21 * priority = 600 range for js init for CDN field file
22 * Priority = 700 range for validation js file
23 * priority = 800 range for conditional js file
24 * @array [fieldType] => [
25 * priority => 'choose one of the priority status code',
26 * filename => 'fileName',
27 * scriptTyp => 'script' or 'init' or 'custom' by default script
28 * source => 'filePath' or 'url' or 'cdn' or className or customClassName by scriptTyp && by default it will be 'filePath'=> 'assets/js/fileName.js'',
29 * fk => 'field key'
30 * field => 'field object'
31 * ]
32
33 * final priority
34 helper js
35 common js
36 custom field script js
37 init for custom field js
38 inti for CDN field js
39 validation js
40 confirmation js
41 conditional js
42 submit js
43 custom js
44 */
45 $initSource = '\\BitCode\\BitForm\\Admin\\Form\\InitJs\\';
46 $files = [
47 'helperScript' => [
48 ['priority' => 101, 'filename' => 'bfSelect.min.js'],
49 ['priority' => 101, 'filename' => 'bfReset.min.js'],
50 ['priority' => 101, 'filename' => 'setBFMsg.min.js'],
51 ['priority' => 101, 'filename' => 'bfSplit.min.js'],
52 ['priority' => 101, 'filename' => 'scrollToElm.min.js'],
53 ['priority' => 101, 'filename' => 'getFldKeyAndRowIndx.min.js'],
54 ['priority' => 101, 'filename' => 'moveToFirstErrFld.min.js'],
55 ['priority' => 101, 'filename' => 'bfValidationErrMsg.min.js'],
56 ['priority' => 101, 'filename' => 'setHiddenFld.min.js'],
57 ['priority' => 101, 'filename' => 'submit-form.min.js'],
58 ['priority' => 101, 'filename' => 'setStyleProperty.min.js']
59 ],
60
61 'text' => [
62 ['priority' => 301, 'filename' => 'initTextLengthHelper.min.js', 'paths' => ['valid->minlength', 'valid->maxlength', 'valid->maxword', 'valid->minword']],
63 ],
64 'textarea' => [
65 ['priority' => 301, 'filename' => 'initTextLengthHelper.min.js', 'paths' => ['valid->minlength', 'valid->maxlength', 'valid->maxword', 'valid->minword']],
66 ],
67 'range' => [
68 ['priority' => 301, 'filename' => 'setSliderFieldValue.min.js', 'path' => 'showValue'],
69 ],
70 'password' => [
71 ['priority' => 301, 'filename' => 'initPasswordStrengthHelper.min.js', 'path' => 'valid->validations'],
72 ['priority' => 301, 'filename' => 'bfTogglePasswordVisibility.min.js', 'path' => 'config->showPasswordIcon'],
73 ],
74 'address' => [
75 ['priority' => 101, 'filename' => 'observeElm.min.js'],
76 ['priority' => 301, 'filename' => 'bit-address-field.min.js'],
77 ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
78 ],
79 'country' => [
80 ['priority' => 101, 'filename' => 'observeElm.min.js'],
81 ['priority' => 301, 'filename' => 'bit-country-field.min.js'],
82 ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
83 ['priority' => 101, 'filename' => 'observeElm.min.js'],
84 ],
85 'currency' => [
86 ['priority' => 101, 'filename' => 'observeElm.min.js'],
87 ['priority' => 301, 'filename' => 'bit-currency-field.min.js'],
88 ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
89 ['priority' => 101, 'filename' => 'observeElm.min.js'],
90 ],
91 'select' => [
92 ['priority' => 101, 'filename' => 'observeElm.min.js'],
93 ['priority' => 301, 'filename' => 'bit-select-field.min.js'],
94 ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
95 ['priority' => 101, 'filename' => 'observeElm.min.js'],
96 ],
97 'file-up' => [
98 ['priority' => 301, 'filename' => 'bit-file-up-field.min.js'],
99 ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
100 ],
101 'phone-number' => [
102 ['priority' => 101, 'filename' => 'observeElm.min.js'],
103 ['priority' => 301, 'filename' => 'bit-phone-number-field.min.js'],
104 ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
105 // ['priority' => 101, 'filename' => 'observeElm.min.js'],
106 ],
107 'section' => [
108 ['priority' => 101, 'filename' => 'hideChildFldHandle.min.js'],
109 ],
110 'repeater' => [
111 ['priority' => 101, 'filename' => 'hideChildFldHandle.min.js'],
112 ['priority' => 102, 'filename' => 'bit-repeater-field.min.js'],
113 ['priority' => 701, 'filename' => 'checkRepeatedField.min.js'],
114 ['priority' => 701, 'filename' => 'isRepeaterField.min.js'],
115 ['priority' => 701, 'filename' => 'getRepeatedIndexes.min.js'],
116 ['priority' => 701, 'filename' => 'getIndexesBaseOnConditions.min.js'],
117 ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
118 ],
119 'recaptcha' => [
120 ['priority' => 301, 'filename' => 'bit-recaptcha-field.min.js'],
121 ['priority' => 302, 'filename' => 'scriptLoader.min.js'],
122 ['priority' => 303, 'filename' => 'initRecaptchaFld.min.js'],
123 ],
124 'hcaptcha' => [
125 ['priority' => 301, 'filename' => 'bit-hcaptcha-field.min.js'],
126 ['priority' => 302, 'filename' => 'scriptLoader.min.js'],
127 ['priority' => 303, 'filename' => 'initHCaptchaFld.min.js'],
128 ],
129 'turnstile' => [
130 ['priority' => 302, 'filename' => 'scriptLoader.min.js'],
131 ['priority' => 303, 'filename' => 'initTurnstileFld.min.js'],
132 ],
133 'decision-box' => [
134 ['priority' => 101, 'filename' => 'decisionFldHandle.min.js'],
135 ],
136 'gdpr' => [
137 ['priority' => 101, 'filename' => 'decisionFldHandle.min.js'],
138 ],
139 'rating' => [
140 ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
141 ['priority' => 301, 'filename' => 'bit-rating-field.min.js'],
142 ],
143 'date' => [
144 ['priority' => 301, 'filename' => 'bfDateFieldsLogicCheck.min.js'],
145 ['priority' => 301, 'filename' => 'bfCalculateDateTimeDifference.min.js'],
146 ['priority' => 301, 'filename' => 'bfAddOrSubtractDateTime.min.js'],
147 ['priority' => 301, 'filename' => 'bfParseDateTime.min.js'],
148 ['priority' => 301, 'filename' => 'bfFormatDateTime.min.js'],
149 ],
150 'datetime-local' => [
151 ['priority' => 301, 'filename' => 'bfDateFieldsLogicCheck.min.js'],
152 ['priority' => 301, 'filename' => 'bfCalculateDateTimeDifference.min.js'],
153 ['priority' => 301, 'filename' => 'bfAddOrSubtractDateTime.min.js'],
154 ['priority' => 301, 'filename' => 'bfParseDateTime.min.js'],
155 ['priority' => 301, 'filename' => 'bfFormatDateTime.min.js'],
156 ],
157 'time' => [
158 ['priority' => 301, 'filename' => 'bfDateFieldsLogicCheck.min.js'],
159 ['priority' => 301, 'filename' => 'bfCalculateDateTimeDifference.min.js'],
160 ['priority' => 301, 'filename' => 'bfAddOrSubtractDateTime.min.js'],
161 ['priority' => 301, 'filename' => 'bfParseDateTime.min.js'],
162 ['priority' => 301, 'filename' => 'bfFormatDateTime.min.js'],
163 ],
164 'month' => [
165 ['priority' => 301, 'filename' => 'bfDateFieldsLogicCheck.min.js'],
166 ['priority' => 301, 'filename' => 'bfCalculateDateTimeDifference.min.js'],
167 ['priority' => 301, 'filename' => 'bfAddOrSubtractDateTime.min.js'],
168 ['priority' => 301, 'filename' => 'bfParseDateTime.min.js'],
169 ['priority' => 301, 'filename' => 'bfFormatDateTime.min.js'],
170 ],
171 'week' => [
172 ['priority' => 301, 'filename' => 'bfDateFieldsLogicCheck.min.js'],
173 ['priority' => 301, 'filename' => 'bfCalculateDateTimeDifference.min.js'],
174 ['priority' => 301, 'filename' => 'bfAddOrSubtractDateTime.min.js'],
175 ['priority' => 301, 'filename' => 'bfParseDateTime.min.js'],
176 ['priority' => 301, 'filename' => 'bfFormatDateTime.min.js'],
177 ],
178 ];
179
180 /**
181 * Allow add-on plugins (e.g. Pro) to register additional script files
182 * without shipping those files/paths in the wp.org (free) package.
183 */
184 return apply_filters('bitform_script_file_priority_list', $files);
185 }
186
187 public static function getAllFldConfs()
188 {
189 // $contentId = $fieldData['contentId'];
190 // $fieldKey = $fieldData['fk'];
191 // $field = $fieldData['field'];
192 // key is config path, value is field path
193 // var is for variable value
194 // path is for field path [ for multiple paths]
195 // val is for static value
196 $configs = [
197
198 'select' => [
199 'config' => (object) [], // sentinel: blocks raw fldData.config passthrough;
200 'fieldKey' => ['var' => 'fieldKey'],
201 'options' => ['path' => 'optionsList'],
202 'placeholder' => ['path' => 'ph'],
203 'classNames' => ['path' => 'customClasses'],
204 'attributes' => ['path' => 'customAttributes'],
205 'defaultValue' => ['path' => ['val', 'config->defaultValue'], 'val' => ''],
206 'separator' => ['val' => BITFORMS_BF_SEPARATOR],
207 'multipleSelect' => ['path' => 'config->multipleSelect', 'val' => false],
208 'showChip' => ['path' => 'config->showChip', 'val' => false],
209 'selectedOptClearable' => ['path' => 'config->selectedOptClearable', 'val' => true],
210 'searchClearable' => ['path' => 'config->searchClearable', 'val' => true],
211 'showSearch' => ['path' => 'config->showSearch', 'val' => true],
212 'searchPlaceholder' => ['path' => 'config->searchPlaceholder', 'val' => ''],
213 'activeList' => ['path' => 'config->activeList', 'val' => 0],
214 ],
215 'address' => [
216 'config' => (object) [],
217 'fieldKey' => ['var' => 'fieldKey'],
218 'contentId' => ['var' => 'contentId'],
219 'assetsURL' => ['val' => BITFORMS_ROOT_URI . '/static/address/'],
220 'fieldName' => ['path' => 'fieldName'],
221 'classNames' => ['path' => 'customClasses'],
222 'attributes' => ['path' => 'customAttributes'],
223 'defaultCountry' => ['path' => 'config->defaultCountry', 'val' => ''],
224 'zipValidation' => ['path' => 'config->zipValidation', 'val' => 'auto'],
225 'zipCustomRegex' => ['path' => 'config->zipCustomRegex', 'val' => ''],
226
227 ],
228 'country' => [
229 'config' => (object) [], // sentinel: blocks raw fldData.config passthrough;
230 'fieldKey' => ['var' => 'fieldKey'],
231 'options' => ['path' => 'options'],
232 'placeholder' => ['path' => 'ph'],
233 'assetsURL' => ['val' => BITFORMS_ROOT_URI . '/static/countries/'],
234 'classNames' => ['path' => 'customClasses'],
235 'attributes' => ['path' => 'customAttributes'],
236 'defaultValue' => ['path' => ['val', 'config->defaultValue'], 'val' => ''],
237 'selectedCountryClearable' => ['path' => 'config->selectedCountryClearable', 'val' => true],
238 'searchClearable' => ['path' => 'config->searchClearable', 'val' => true],
239 'searchPlaceholder' => ['path' => 'config->searchPlaceholder', 'val' => ''],
240 ],
241 'currency' => [
242 'config' => (object) [], // sentinel: blocks raw fldData.config
243 'fieldKey' => ['var' => 'fieldKey'],
244 'options' => ['path' => 'options'],
245 'assetsURL' => ['val' => BITFORMS_ROOT_URI . '/static/currencies/'],
246 'classNames' => ['path' => 'customClasses'],
247 'attributes' => ['path' => 'customAttributes'],
248 'defaultValue' => ['path' => ['val', 'config->defaultValue'], 'val' => ''],
249 'selectedCurrencyClearable' => ['path' => 'config->selectedCurrencyClearable', 'val' => true],
250 'searchClearable' => ['path' => 'config->searchClearable', 'val' => true],
251 'searchPlaceholder' => ['path' => 'config->searchPlaceholder', 'val' => ''],
252 ],
253 'phone-number' => [
254 'config' => (object) [], // sentinel: blocks raw fldData.config passthrough;
255 'fieldKey' => ['var' => 'fieldKey'],
256 'options' => ['path' => 'options'],
257 'assetsURL' => ['val' => BITFORMS_ROOT_URI . '/static/countries/'],
258 'classNames' => ['path' => 'customClasses'],
259 'attributes' => ['path' => 'customAttributes'],
260 'contentId' => ['var' => 'contentId'],
261 'selectedCountryClearable' => ['path' => 'config->selectedCountryClearable', 'val' => true],
262 'searchClearable' => ['path' => 'config->searchClearable', 'val' => true],
263 'searchPlaceholder' => ['path' => 'config->searchPlaceholder', 'val' => ''],
264 ],
265 'file-up' => [
266 'config' => (object) [], // sentinel: blocks raw fldData.config passthrough;
267 'fieldKey' => ['var' => 'fieldKey'],
268 'formID' => ['var' => 'formId'],
269 'maxSizeErrMsg' => ['path' => ['err->maxSize->msg', 'err->maxSize->dflt']],
270 'minFileErrMsg' => ['path' => ['err->minFile->msg', 'err->minFile->dflt']],
271 'maxFileErrMsg' => ['path' => ['err->maxFile->msg', 'err->maxFile->dflt']],
272 'assetsURL' => ['val' => BITFORMS_ROOT_URI . '/static/file-upload'],
273 'classNames' => ['path' => 'customClasses'],
274 'attributes' => ['path' => 'customAttributes'],
275 'fieldName' => ['path' => 'fieldName'],
276 'contentId' => ['var' => 'contentId'],
277 'multiple' => ['path' => 'config->multiple', 'val' => false],
278 'allowMaxSize' => ['path' => 'config->allowMaxSize', 'val' => false],
279 'maxSize' => ['path' => 'config->maxSize', 'val' => 0],
280 'sizeUnit' => ['path' => 'config->sizeUnit', 'val' => 'KB'],
281 'isItTotalMax' => ['path' => 'config->isItTotalMax', 'val' => false],
282 'allowedFileType' => ['path' => 'config->allowedFileType', 'val' => ''],
283 'minFile' => ['path' => 'config->minFile', 'val' => 0],
284 'maxFile' => ['path' => 'config->maxFile', 'val' => 0],
285 'showSelectStatus' => ['path' => 'config->showSelectStatus', 'val' => false],
286 'fileSelectStatus' => ['path' => 'config->fileSelectStatus', 'val' => 'No File Selected'],
287 'oldFiles' => ['path' => 'config->oldFiles', 'val' => []],
288 'baseDLURL' => ['path' => 'config->baseDLURL', 'val' => ''],
289 'fileExistMsg' => ['val' => 'A file already exist'],
290 'showFileList' => ['path' => 'config->showFileList', 'val' => false],
291 'showFilePreview' => ['path' => 'config->showFilePreview', 'val' => false],
292 'showFileSize' => ['path' => 'config->showFileSize', 'val' => false],
293 'fileExistMsg' => ['path' => 'config->fileExistMsg', 'val' => 'A file already exist'],
294 ],
295 'repeater' => [
296 'config' => (object) [],
297 'fieldKey' => ['var' => 'fieldKey'],
298 'fieldName' => ['path' => 'fieldName'],
299 'contentId' => ['var' => 'contentId'],
300 'showAddBtn' => ['path' => 'addBtn->show', 'val' => false],
301 'showAddToEndBtn' => ['path' => 'addToEndBtn->show', 'val' => false],
302 'defaultValue' => ['path' => 'val', 'val' => ''],
303 ],
304 'rating' => [
305 'fieldKey' => ['var' => 'fieldKey'],
306 'contentId' => ['var' => 'contentId'],
307 'options' => ['path' => 'opt'],
308 'selectedRating' => ['path' => 'selectedRating'],
309 'defaultValue' => ['path' => ['val', 'config->defaultValue'], 'val'=> ''],
310 ],
311 'hcaptcha'=> [
312 'fieldKey' => ['var'=>'fieldKey']
313 ],
314 ];
315 /**
316 * Allow add-on plugins to extend field config mappings.
317 */
318 return apply_filters('bitform_field_config_paths', $configs);
319 }
320
321 public static function multiStepFiles()
322 {
323 return [
324 ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
325 ['priority' => 201, 'filename' => 'isFormValidatedWithoutError.min.js'],
326 ['priority' => 202, 'filename' => 'saveFormProgress.min.js'],
327 ['priority' => 700, 'filename' => 'bit-multi-step-form.min.js'],
328 ];
329 }
330
331 public static function conversationalFormFiles()
332 {
333 return [
334 ['priority' => 202, 'filename' => 'saveFormProgress.min.js'],
335 ['priority' => 700, 'filename' => 'bit-conversational-form.min.js'],
336 ['priority' => 700, 'filename' => 'handleConversationalFormMsg.min.js'],
337 ];
338 }
339
340 public static function frontendScriptFile()
341 {
342 return [
343 'observeElm' => ['priority' => 101, 'filename' => 'observeElm.min.js'],
344 'hidden-token-field' => ['priority' => 300, 'filename' => 'hidden-token-field.min.js'],
345 ];
346 }
347
348 public static function validationAndOtherScriptFile()
349 {
350 $files = [
351 'confirmFldMatch' => ['priority' => 701, 'filename' => 'confirmFldMatch.min.js'],
352 'checkFldValidation' => ['priority' => 701, 'filename' => 'checkFldValidation.min.js'],
353 // 'checkMinMaxOptions' => ['priority' => 702, 'filename' => 'checkMinMaxOptions.min.js'],
354 // 'bfDatetimeFldValidation' => ['priority' => 702, 'filename' => 'bfDatetimeFldValidation.min.js'],
355 'bfParseDateTime' => ['priority' => 301, 'filename' => 'bfParseDateTime.min.js'],
356 'checkMinMaxValue' => ['priority' => 702, 'filename' => 'checkMinMaxValue.min.js'],
357 'textLengthValidation' => ['priority' => 702, 'filename' => 'textLengthValidation.min.js'],
358 'customOptionValidation' => ['priority' => 702, 'filename' => 'customOptionValidation.min.js'],
359 'dcsnbxFldValidation' => ['priority' => 702, 'filename' => 'dcsnbxFldValidation.min.js'],
360 'emailFldValidation' => ['priority' => 702, 'filename' => 'emailFldValidation.min.js'],
361 'fileupFldValidation' => ['priority' => 702, 'filename' => 'fileupFldValidation.min.js'],
362 'advanceFileupFldValidation' => ['priority' => 702, 'filename' => 'advanceFileUpFldValidation.min.js'],
363 'phoneNumberFldValidation' => ['priority' => 702, 'filename' => 'phoneNumberFldValidation.min.js'],
364 'currencyFldValidation' => ['priority' => 702, 'filename' => 'currencyFldValidation.min.js'],
365 'addressZipFldValidation' => ['priority' => 702, 'filename' => 'addressZipFldValidation.min.js'],
366 'generateBackslashPattern' => ['priority' => 700, 'filename' => 'generateBackslashPattern.min.js'],
367 // 'nmbrFldValidation' => ['priority' => 702, 'filename' => 'nmbrFldValidation.min.js'],
368 // 'regexPatternValidation' => ['priority' => 701, 'filename' => 'regexPatternValidation.min.js'], // load before generateBackslashPattern file, then load regexPatternValidation
369 'inputMaskValidation' => ['priority' => 701, 'filename' => 'inputMaskValidation.min.js'], // load before generateBackslashPattern file, then load inputMaskValidation
370 'bit-input-mask' => ['priority' => 701, 'filename' => 'bit-input-mask.min.js'], // load before generateBackslashPattern file, then load bit-input-mask
371 'setBitInputMaskToInput' => ['priority' => 702, 'filename' => 'setBitInputMaskToInput.min.js'], // load before generateBackslashPattern file, then load setBitInputMaskToInput
372 'requiredFldValidation' => ['priority' => 700, 'filename' => 'requiredFldValidation.min.js'],
373 'urlFldValidation' => ['priority' => 702, 'filename' => 'urlFldValidation.min.js'],
374 'validation' => ['priority' => 705, 'filename' => 'validateForm.min.js'], // last priority for validation script
375 'conditionalLogic' => ['priority' => 705, 'filename' => 'bit-conditionals.min.js'], // last priority for validation script
376 'resetPlaceholders' => ['priority' => 201, 'filename' => 'resetPlaceholders.min.js'],
377 'bfResetDefaultValue' => ['priority' => 201, 'filename' => 'bfResetDefaultValue.min.js'],
378 'validateFocusLost' => ['priority' => 706, 'filename' => 'validate-focus.min.js'], // last priority for validation script
379 ];
380
381 /**
382 * Allow add-on plugins to register additional validation scripts.
383 */
384 return apply_filters('bitform_validation_and_other_script_files', $files);
385 }
386
387 public static function validationScriptFileMapping($fieldType)
388 {
389 // Pro filter callbacks type-hint string; never let null/non-string through.
390 $fieldType = is_string($fieldType) ? $fieldType : '';
391 $textTypeField = ['text', 'password', 'username', 'color'];
392 if (in_array($fieldType, $textTypeField)) {
393 $fieldType = 'text';
394 }
395 $fields =
396 [
397 'text' => [
398 'bit-input-mask' => [
399 'paths' => ['valid->inputMask'],
400 ],
401 'inputMaskValidation' => [
402 'paths' => ['valid->inputMask'],
403 'dependencies' => [
404 'generateBackslashPattern',
405 'validation',
406 ]
407 ],
408 'setBitInputMaskToInput' => [
409 'paths' => ['valid->inputMask'],
410 'dependencies' => [
411 'bit-input-mask'
412 ]
413 ],
414 'textLengthValidation' => [
415 'paths' => ['valid->minlength', 'valid->maxlength', 'valid->minword', 'valid->maxword']
416 ],
417 'confirmFldMatch' => [
418 'paths' => ['parentFieldKey'],
419 ]
420
421 ],
422 'textarea' => [
423 'bit-input-mask' => [
424 'paths' => ['valid->inputMask'],
425 ],
426 'inputMaskValidation' => [
427 'paths' => ['valid->inputMask'],
428 'dependencies' => [
429 'generateBackslashPattern',
430 'validation',
431 ]
432 ],
433 'setBitInputMaskToInput' => [
434 'paths' => ['valid->inputMask'],
435 'dependencies' => [
436 'bit-input-mask'
437 ]
438 ],
439 'textLengthValidation' => [
440 'paths' => ['valid->minlength', 'valid->maxlength', 'valid->minword', 'valid->maxword']
441 ]
442 ],
443 'email' => [
444 'emailFldValidation' => [
445 'paths' => ['err->invalid->show'],
446 'dependencies' => [
447 'generateBackslashPattern'
448 ]
449 ],
450 'confirmFldMatch' => [
451 'paths' => ['parentFieldKey'],
452 ]
453 ],
454 'number' => [
455 'nmbrFldValidation' => [
456 'paths' => ['mn', 'mx']
457 ]
458 ],
459 'range' => [
460 'checkMinMaxValue' => [
461 'paths' => ['mn', 'mx']
462 ]
463 ],
464 'url' => [
465 'urlFldValidation' => [
466 'paths' => ['err->invalid->show'],
467 'dependencies' => [
468 'generateBackslashPattern'
469 ]
470 ],
471 'bit-input-mask' => [
472 'paths' => ['valid->inputMask'],
473 ],
474 'inputMaskValidation' => [
475 'paths' => ['valid->inputMask'],
476 'dependencies' => [
477 'generateBackslashPattern',
478 'validation',
479 ]
480 ],
481 'setBitInputMaskToInput' => [
482 'paths' => ['valid->inputMask'],
483 'dependencies' => [
484 'bit-input-mask'
485 ]
486 ]
487 ],
488 'decision-box' => [
489 'dcsnbxFldValidation' => [
490 'paths' => ['valid->req']
491 ]
492 ],
493 'gdpr' => [
494 'dcsnbxFldValidation' => [
495 'paths' => ['valid->req']
496 ]
497 ],
498 'file-up' => [
499 'fileupFldValidation' => [
500 'paths' => ['valid->req']
501 ]
502 ],
503 'phone-number' => [
504 'phoneNumberFldValidation' => [
505 'paths' => ['err->invalid->show'],
506 ]
507 ],
508 'address' => [
509 'addressZipFldValidation' => [
510 'paths' => ['config->zipValidation'],
511 'dependencies' => [
512 'validation',
513 ]
514 ]
515 ],
516 ];
517 $mapping = isset($fields[$fieldType]) ? $fields[$fieldType] : [];
518
519 /**
520 * Allow pro add-ons to extend/override mapping per field type.
521 */
522 return apply_filters('bitform_field_validation_script_file_mapping', $mapping, $fieldType);
523 }
524 }
525