PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / V3.3.2
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder vV3.3.2
V3.3.2 3.3.1 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 All 139 releases
bit-form / includes / Admin / Form / ScriptFilePriorityManager.php

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

535 lines 25.6 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 // Fills field-value Smart Tags (e.g. ${b1-3}) in HTML elements as the visitor types
111 'html' => [
112 ['priority' => 301, 'filename' => 'bfHtmlFieldValueTags.min.js'],
113 ],
114 'repeater' => [
115 ['priority' => 101, 'filename' => 'hideChildFldHandle.min.js'],
116 ['priority' => 102, 'filename' => 'bit-repeater-field.min.js'],
117 ['priority' => 701, 'filename' => 'checkRepeatedField.min.js'],
118 ['priority' => 701, 'filename' => 'isRepeaterField.min.js'],
119 ['priority' => 701, 'filename' => 'getRepeatedIndexes.min.js'],
120 ['priority' => 701, 'filename' => 'getIndexesBaseOnConditions.min.js'],
121 ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
122 ],
123 'recaptcha' => [
124 ['priority' => 301, 'filename' => 'bit-recaptcha-field.min.js'],
125 ['priority' => 302, 'filename' => 'scriptLoader.min.js'],
126 ['priority' => 303, 'filename' => 'initRecaptchaFld.min.js'],
127 ],
128 'hcaptcha' => [
129 ['priority' => 301, 'filename' => 'bit-hcaptcha-field.min.js'],
130 ['priority' => 302, 'filename' => 'scriptLoader.min.js'],
131 ['priority' => 303, 'filename' => 'initHCaptchaFld.min.js'],
132 ],
133 'turnstile' => [
134 ['priority' => 302, 'filename' => 'scriptLoader.min.js'],
135 ['priority' => 303, 'filename' => 'initTurnstileFld.min.js'],
136 ],
137 'decision-box' => [
138 ['priority' => 101, 'filename' => 'decisionFldHandle.min.js'],
139 ],
140 'gdpr' => [
141 ['priority' => 101, 'filename' => 'decisionFldHandle.min.js'],
142 ],
143 'rating' => [
144 ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
145 ['priority' => 301, 'filename' => 'bit-rating-field.min.js'],
146 ],
147 'date' => [
148 ['priority' => 301, 'filename' => 'bfDateFieldsLogicCheck.min.js'],
149 ['priority' => 301, 'filename' => 'bfCalculateDateTimeDifference.min.js'],
150 ['priority' => 301, 'filename' => 'bfAddOrSubtractDateTime.min.js'],
151 ['priority' => 301, 'filename' => 'bfParseDateTime.min.js'],
152 ['priority' => 301, 'filename' => 'bfFormatDateTime.min.js'],
153 ],
154 'datetime-local' => [
155 ['priority' => 301, 'filename' => 'bfDateFieldsLogicCheck.min.js'],
156 ['priority' => 301, 'filename' => 'bfCalculateDateTimeDifference.min.js'],
157 ['priority' => 301, 'filename' => 'bfAddOrSubtractDateTime.min.js'],
158 ['priority' => 301, 'filename' => 'bfParseDateTime.min.js'],
159 ['priority' => 301, 'filename' => 'bfFormatDateTime.min.js'],
160 ],
161 'time' => [
162 ['priority' => 301, 'filename' => 'bfDateFieldsLogicCheck.min.js'],
163 ['priority' => 301, 'filename' => 'bfCalculateDateTimeDifference.min.js'],
164 ['priority' => 301, 'filename' => 'bfAddOrSubtractDateTime.min.js'],
165 ['priority' => 301, 'filename' => 'bfParseDateTime.min.js'],
166 ['priority' => 301, 'filename' => 'bfFormatDateTime.min.js'],
167 ],
168 'month' => [
169 ['priority' => 301, 'filename' => 'bfDateFieldsLogicCheck.min.js'],
170 ['priority' => 301, 'filename' => 'bfCalculateDateTimeDifference.min.js'],
171 ['priority' => 301, 'filename' => 'bfAddOrSubtractDateTime.min.js'],
172 ['priority' => 301, 'filename' => 'bfParseDateTime.min.js'],
173 ['priority' => 301, 'filename' => 'bfFormatDateTime.min.js'],
174 ],
175 'week' => [
176 ['priority' => 301, 'filename' => 'bfDateFieldsLogicCheck.min.js'],
177 ['priority' => 301, 'filename' => 'bfCalculateDateTimeDifference.min.js'],
178 ['priority' => 301, 'filename' => 'bfAddOrSubtractDateTime.min.js'],
179 ['priority' => 301, 'filename' => 'bfParseDateTime.min.js'],
180 ['priority' => 301, 'filename' => 'bfFormatDateTime.min.js'],
181 ],
182 ];
183
184 /**
185 * Allow add-on plugins (e.g. Pro) to register additional script files
186 * without shipping those files/paths in the wp.org (free) package.
187 */
188 return apply_filters('bitform_script_file_priority_list', $files);
189 }
190
191 public static function getAllFldConfs()
192 {
193 // $contentId = $fieldData['contentId'];
194 // $fieldKey = $fieldData['fk'];
195 // $field = $fieldData['field'];
196 // key is config path, value is field path
197 // var is for variable value
198 // path is for field path [ for multiple paths]
199 // val is for static value
200 $configs = [
201
202 'select' => [
203 'config' => (object) [], // sentinel: blocks raw fldData.config passthrough;
204 'fieldKey' => ['var' => 'fieldKey'],
205 'options' => ['path' => 'optionsList'],
206 'placeholder' => ['path' => 'ph'],
207 'classNames' => ['path' => 'customClasses'],
208 'attributes' => ['path' => 'customAttributes'],
209 'defaultValue' => ['path' => ['val', 'config->defaultValue'], 'val' => ''],
210 'separator' => ['val' => BITFORMS_BF_SEPARATOR],
211 'multipleSelect' => ['path' => 'config->multipleSelect', 'val' => false],
212 'showChip' => ['path' => 'config->showChip', 'val' => false],
213 'selectedOptClearable' => ['path' => 'config->selectedOptClearable', 'val' => true],
214 'searchClearable' => ['path' => 'config->searchClearable', 'val' => true],
215 'showSearch' => ['path' => 'config->showSearch', 'val' => true],
216 'searchPlaceholder' => ['path' => 'config->searchPlaceholder', 'val' => ''],
217 'activeList' => ['path' => 'config->activeList', 'val' => 0],
218 ],
219 'address' => [
220 'config' => (object) [],
221 'fieldKey' => ['var' => 'fieldKey'],
222 'contentId' => ['var' => 'contentId'],
223 'assetsURL' => ['val' => BITFORMS_ROOT_URI . '/static/address/'],
224 'fieldName' => ['path' => 'fieldName'],
225 'classNames' => ['path' => 'customClasses'],
226 'attributes' => ['path' => 'customAttributes'],
227 'defaultCountry' => ['path' => 'config->defaultCountry', 'val' => ''],
228 'zipValidation' => ['path' => 'config->zipValidation', 'val' => 'auto'],
229 'zipCustomRegex' => ['path' => 'config->zipCustomRegex', 'val' => ''],
230
231 ],
232 'country' => [
233 'config' => (object) [], // sentinel: blocks raw fldData.config passthrough;
234 'fieldKey' => ['var' => 'fieldKey'],
235 'options' => ['path' => 'options'],
236 'placeholder' => ['path' => 'ph'],
237 'assetsURL' => ['val' => BITFORMS_ROOT_URI . '/static/countries/'],
238 'classNames' => ['path' => 'customClasses'],
239 'attributes' => ['path' => 'customAttributes'],
240 'defaultValue' => ['path' => ['val', 'config->defaultValue'], 'val' => ''],
241 'selectedCountryClearable' => ['path' => 'config->selectedCountryClearable', 'val' => true],
242 'searchClearable' => ['path' => 'config->searchClearable', 'val' => true],
243 'searchPlaceholder' => ['path' => 'config->searchPlaceholder', 'val' => ''],
244 ],
245 'currency' => [
246 'config' => (object) [], // sentinel: blocks raw fldData.config
247 'fieldKey' => ['var' => 'fieldKey'],
248 'options' => ['path' => 'options'],
249 'assetsURL' => ['val' => BITFORMS_ROOT_URI . '/static/currencies/'],
250 'classNames' => ['path' => 'customClasses'],
251 'attributes' => ['path' => 'customAttributes'],
252 'defaultValue' => ['path' => ['val', 'config->defaultValue'], 'val' => ''],
253 'selectedCurrencyClearable' => ['path' => 'config->selectedCurrencyClearable', 'val' => true],
254 'searchClearable' => ['path' => 'config->searchClearable', 'val' => true],
255 'searchPlaceholder' => ['path' => 'config->searchPlaceholder', 'val' => ''],
256 ],
257 'phone-number' => [
258 'config' => (object) [], // sentinel: blocks raw fldData.config passthrough;
259 'fieldKey' => ['var' => 'fieldKey'],
260 'options' => ['path' => 'options'],
261 'assetsURL' => ['val' => BITFORMS_ROOT_URI . '/static/countries/'],
262 'classNames' => ['path' => 'customClasses'],
263 'attributes' => ['path' => 'customAttributes'],
264 'contentId' => ['var' => 'contentId'],
265 'selectedCountryClearable' => ['path' => 'config->selectedCountryClearable', 'val' => true],
266 'searchClearable' => ['path' => 'config->searchClearable', 'val' => true],
267 'searchPlaceholder' => ['path' => 'config->searchPlaceholder', 'val' => ''],
268 // v3 Edit Options saved the default country as config->defaultValue before it wrote defaultCountryKey.
269 'defaultCountryKey' => ['path' => ['config->defaultCountryKey', 'config->defaultValue'], 'val' => ''],
270 ],
271 'file-up' => [
272 'config' => (object) [], // sentinel: blocks raw fldData.config passthrough;
273 'fieldKey' => ['var' => 'fieldKey'],
274 'formID' => ['var' => 'formId'],
275 'maxSizeErrMsg' => ['path' => ['err->maxSize->msg', 'err->maxSize->dflt']],
276 'minFileErrMsg' => ['path' => ['err->minFile->msg', 'err->minFile->dflt']],
277 'maxFileErrMsg' => ['path' => ['err->maxFile->msg', 'err->maxFile->dflt']],
278 'assetsURL' => ['val' => BITFORMS_ROOT_URI . '/static/file-upload'],
279 'classNames' => ['path' => 'customClasses'],
280 'attributes' => ['path' => 'customAttributes'],
281 'fieldName' => ['path' => 'fieldName'],
282 'contentId' => ['var' => 'contentId'],
283 'multiple' => ['path' => 'config->multiple', 'val' => false],
284 'allowMaxSize' => ['path' => 'config->allowMaxSize', 'val' => false],
285 'maxSize' => ['path' => 'config->maxSize', 'val' => 0],
286 'sizeUnit' => ['path' => 'config->sizeUnit', 'val' => 'KB'],
287 'isItTotalMax' => ['path' => 'config->isItTotalMax', 'val' => false],
288 'allowedFileType' => ['path' => 'config->allowedFileType', 'val' => ''],
289 'minFile' => ['path' => 'config->minFile', 'val' => 0],
290 'maxFile' => ['path' => 'config->maxFile', 'val' => 0],
291 'showSelectStatus' => ['path' => 'config->showSelectStatus', 'val' => false],
292 'fileSelectStatus' => ['path' => 'config->fileSelectStatus', 'val' => 'No File Selected'],
293 'oldFiles' => ['path' => 'config->oldFiles', 'val' => []],
294 'baseDLURL' => ['path' => 'config->baseDLURL', 'val' => ''],
295 'fileExistMsg' => ['val' => 'A file already exist'],
296 'showFileList' => ['path' => 'config->showFileList', 'val' => false],
297 'showFilePreview' => ['path' => 'config->showFilePreview', 'val' => false],
298 'showFileSize' => ['path' => 'config->showFileSize', 'val' => false],
299 'fileExistMsg' => ['path' => 'config->fileExistMsg', 'val' => 'A file already exist'],
300 ],
301 'repeater' => [
302 'config' => (object) [],
303 'fieldKey' => ['var' => 'fieldKey'],
304 'fieldName' => ['path' => 'fieldName'],
305 'contentId' => ['var' => 'contentId'],
306 'showAddBtn' => ['path' => 'addBtn->show', 'val' => false],
307 'showAddToEndBtn' => ['path' => 'addToEndBtn->show', 'val' => false],
308 'defaultValue' => ['path' => 'val', 'val' => ''],
309 ],
310 'rating' => [
311 'fieldKey' => ['var' => 'fieldKey'],
312 'contentId' => ['var' => 'contentId'],
313 'options' => ['path' => 'opt'],
314 'selectedRating' => ['path' => 'selectedRating'],
315 'defaultValue' => ['path' => ['val', 'config->defaultValue'], 'val'=> ''],
316 ],
317 'hcaptcha'=> [
318 'fieldKey' => ['var'=>'fieldKey']
319 ],
320 ];
321 /**
322 * Allow add-on plugins to extend field config mappings.
323 */
324 return apply_filters('bitform_field_config_paths', $configs);
325 }
326
327 public static function multiStepFiles()
328 {
329 return [
330 ['priority' => 201, 'filename' => 'customFieldsReset.min.js'],
331 ['priority' => 201, 'filename' => 'isFormValidatedWithoutError.min.js'],
332 ['priority' => 202, 'filename' => 'saveFormProgress.min.js'],
333 ['priority' => 700, 'filename' => 'bit-multi-step-form.min.js'],
334 ];
335 }
336
337 public static function conversationalFormFiles()
338 {
339 return [
340 ['priority' => 202, 'filename' => 'saveFormProgress.min.js'],
341 ['priority' => 700, 'filename' => 'bit-conversational-form.min.js'],
342 ['priority' => 700, 'filename' => 'handleConversationalFormMsg.min.js'],
343 ];
344 }
345
346 public static function frontendScriptFile()
347 {
348 return [
349 'observeElm' => ['priority' => 101, 'filename' => 'observeElm.min.js'],
350 'hidden-token-field' => ['priority' => 300, 'filename' => 'hidden-token-field.min.js'],
351 ];
352 }
353
354 public static function validationAndOtherScriptFile()
355 {
356 $files = [
357 'confirmFldMatch' => ['priority' => 701, 'filename' => 'confirmFldMatch.min.js'],
358 'checkFldValidation' => ['priority' => 701, 'filename' => 'checkFldValidation.min.js'],
359 // 'checkMinMaxOptions' => ['priority' => 702, 'filename' => 'checkMinMaxOptions.min.js'],
360 // 'bfDatetimeFldValidation' => ['priority' => 702, 'filename' => 'bfDatetimeFldValidation.min.js'],
361 'bfParseDateTime' => ['priority' => 301, 'filename' => 'bfParseDateTime.min.js'],
362 'checkMinMaxValue' => ['priority' => 702, 'filename' => 'checkMinMaxValue.min.js'],
363 'textLengthValidation' => ['priority' => 702, 'filename' => 'textLengthValidation.min.js'],
364 'customOptionValidation' => ['priority' => 702, 'filename' => 'customOptionValidation.min.js'],
365 'dcsnbxFldValidation' => ['priority' => 702, 'filename' => 'dcsnbxFldValidation.min.js'],
366 'emailFldValidation' => ['priority' => 702, 'filename' => 'emailFldValidation.min.js'],
367 'fileupFldValidation' => ['priority' => 702, 'filename' => 'fileupFldValidation.min.js'],
368 'advanceFileupFldValidation' => ['priority' => 702, 'filename' => 'advanceFileUpFldValidation.min.js'],
369 'phoneNumberFldValidation' => ['priority' => 702, 'filename' => 'phoneNumberFldValidation.min.js'],
370 'currencyFldValidation' => ['priority' => 702, 'filename' => 'currencyFldValidation.min.js'],
371 'addressZipFldValidation' => ['priority' => 702, 'filename' => 'addressZipFldValidation.min.js'],
372 'generateBackslashPattern' => ['priority' => 700, 'filename' => 'generateBackslashPattern.min.js'],
373 // 'nmbrFldValidation' => ['priority' => 702, 'filename' => 'nmbrFldValidation.min.js'],
374 'nmbrBadInputValidation' => ['priority' => 702, 'filename' => 'nmbrBadInputValidation.min.js'],
375 // 'regexPatternValidation' => ['priority' => 701, 'filename' => 'regexPatternValidation.min.js'], // load before generateBackslashPattern file, then load regexPatternValidation
376 'inputMaskValidation' => ['priority' => 701, 'filename' => 'inputMaskValidation.min.js'], // load before generateBackslashPattern file, then load inputMaskValidation
377 'bit-input-mask' => ['priority' => 701, 'filename' => 'bit-input-mask.min.js'], // load before generateBackslashPattern file, then load bit-input-mask
378 'setBitInputMaskToInput' => ['priority' => 702, 'filename' => 'setBitInputMaskToInput.min.js'], // load before generateBackslashPattern file, then load setBitInputMaskToInput
379 'requiredFldValidation' => ['priority' => 700, 'filename' => 'requiredFldValidation.min.js'],
380 'urlFldValidation' => ['priority' => 702, 'filename' => 'urlFldValidation.min.js'],
381 'validation' => ['priority' => 705, 'filename' => 'validateForm.min.js'], // last priority for validation script
382 'conditionalLogic' => ['priority' => 705, 'filename' => 'bit-conditionals.min.js'], // last priority for validation script
383 'resetPlaceholders' => ['priority' => 201, 'filename' => 'resetPlaceholders.min.js'],
384 'bfResetDefaultValue' => ['priority' => 201, 'filename' => 'bfResetDefaultValue.min.js'],
385 'validateFocusLost' => ['priority' => 706, 'filename' => 'validate-focus.min.js'], // last priority for validation script
386 ];
387
388 /**
389 * Allow add-on plugins to register additional validation scripts.
390 */
391 return apply_filters('bitform_validation_and_other_script_files', $files);
392 }
393
394 public static function validationScriptFileMapping($fieldType)
395 {
396 // Pro filter callbacks type-hint string; never let null/non-string through.
397 $fieldType = is_string($fieldType) ? $fieldType : '';
398 $textTypeField = ['text', 'password', 'username', 'color'];
399 if (in_array($fieldType, $textTypeField)) {
400 $fieldType = 'text';
401 }
402 $fields =
403 [
404 'text' => [
405 'bit-input-mask' => [
406 'paths' => ['valid->inputMask'],
407 ],
408 'inputMaskValidation' => [
409 'paths' => ['valid->inputMask'],
410 'dependencies' => [
411 'generateBackslashPattern',
412 'validation',
413 ]
414 ],
415 'setBitInputMaskToInput' => [
416 'paths' => ['valid->inputMask'],
417 'dependencies' => [
418 'bit-input-mask'
419 ]
420 ],
421 'textLengthValidation' => [
422 'paths' => ['valid->minlength', 'valid->maxlength', 'valid->minword', 'valid->maxword']
423 ],
424 'confirmFldMatch' => [
425 'paths' => ['parentFieldKey'],
426 ]
427
428 ],
429 'textarea' => [
430 'bit-input-mask' => [
431 'paths' => ['valid->inputMask'],
432 ],
433 'inputMaskValidation' => [
434 'paths' => ['valid->inputMask'],
435 'dependencies' => [
436 'generateBackslashPattern',
437 'validation',
438 ]
439 ],
440 'setBitInputMaskToInput' => [
441 'paths' => ['valid->inputMask'],
442 'dependencies' => [
443 'bit-input-mask'
444 ]
445 ],
446 'textLengthValidation' => [
447 'paths' => ['valid->minlength', 'valid->maxlength', 'valid->minword', 'valid->maxword']
448 ]
449 ],
450 'email' => [
451 'emailFldValidation' => [
452 'paths' => ['err->invalid->show'],
453 'dependencies' => [
454 'generateBackslashPattern'
455 ]
456 ],
457 'confirmFldMatch' => [
458 'paths' => ['parentFieldKey'],
459 ]
460 ],
461 'number' => [
462 'nmbrFldValidation' => [
463 'paths' => ['mn', 'mx']
464 ],
465 'nmbrBadInputValidation' => [
466 'paths' => ['err->invalid->show']
467 ]
468 ],
469 'range' => [
470 'checkMinMaxValue' => [
471 'paths' => ['mn', 'mx']
472 ]
473 ],
474 'url' => [
475 'urlFldValidation' => [
476 'paths' => ['err->invalid->show'],
477 'dependencies' => [
478 'generateBackslashPattern'
479 ]
480 ],
481 'bit-input-mask' => [
482 'paths' => ['valid->inputMask'],
483 ],
484 'inputMaskValidation' => [
485 'paths' => ['valid->inputMask'],
486 'dependencies' => [
487 'generateBackslashPattern',
488 'validation',
489 ]
490 ],
491 'setBitInputMaskToInput' => [
492 'paths' => ['valid->inputMask'],
493 'dependencies' => [
494 'bit-input-mask'
495 ]
496 ]
497 ],
498 'decision-box' => [
499 'dcsnbxFldValidation' => [
500 'paths' => ['valid->req']
501 ]
502 ],
503 'gdpr' => [
504 'dcsnbxFldValidation' => [
505 'paths' => ['valid->req']
506 ]
507 ],
508 'file-up' => [
509 'fileupFldValidation' => [
510 'paths' => ['valid->req']
511 ]
512 ],
513 'phone-number' => [
514 'phoneNumberFldValidation' => [
515 'paths' => ['err->invalid->show'],
516 ]
517 ],
518 'address' => [
519 'addressZipFldValidation' => [
520 'paths' => ['config->zipValidation'],
521 'dependencies' => [
522 'validation',
523 ]
524 ]
525 ],
526 ];
527 $mapping = isset($fields[$fieldType]) ? $fields[$fieldType] : [];
528
529 /**
530 * Allow pro add-ons to extend/override mapping per field type.
531 */
532 return apply_filters('bitform_field_validation_script_file_mapping', $mapping, $fieldType);
533 }
534 }
535