← All changes
|
includes/Admin/Form/ScriptFilePriorityManager.php
+245
-302
3.1.2
→
2.7.0
View file →
| @@ -42,14 +42,14 @@ | ||
| 42 | 42 | submit js |
| 43 | 43 | custom js |
| 44 | 44 | */ |
| 45 | 45 | $initSource = '\\BitCode\\BitForm\\Admin\\Form\\InitJs\\'; |
| 46 | - $files = [ | |
| 46 | + $customSource = '\\BitCode\\BitForm\\Admin\\Form\\ExtraFieldJS\\'; | |
| 47 | + return [ | |
| 47 | 48 | 'helperScript' => [ |
| 48 | 49 | ['priority' => 101, 'filename' => 'bfSelect.min.js'], |
| 49 | 50 | ['priority' => 101, 'filename' => 'bfReset.min.js'], |
| 50 | 51 | ['priority' => 101, 'filename' => 'setBFMsg.min.js'], |
| 51 | - ['priority' => 101, 'filename' => 'bfSplit.min.js'], | |
| 52 | 52 | ['priority' => 101, 'filename' => 'scrollToElm.min.js'], |
| 53 | 53 | ['priority' => 101, 'filename' => 'getFldKeyAndRowIndx.min.js'], |
| 54 | 54 | ['priority' => 101, 'filename' => 'moveToFirstErrFld.min.js'], |
| 55 | 55 | ['priority' => 101, 'filename' => 'bfValidationErrMsg.min.js'], |
| @@ -56,27 +56,8 @@ | ||
| 56 | 56 | ['priority' => 101, 'filename' => 'setHiddenFld.min.js'], |
| 57 | 57 | ['priority' => 101, 'filename' => 'submit-form.min.js'], |
| 58 | 58 | ['priority' => 101, 'filename' => 'setStyleProperty.min.js'] |
| 59 | 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 | 60 | 'country' => [ |
| 80 | 61 | ['priority' => 101, 'filename' => 'observeElm.min.js'], |
| 81 | 62 | ['priority' => 301, 'filename' => 'bit-country-field.min.js'], |
| 82 | 63 | ['priority' => 201, 'filename' => 'customFieldsReset.min.js'], |
| @@ -93,8 +74,15 @@ | ||
| 93 | 74 | ['priority' => 301, 'filename' => 'bit-select-field.min.js'], |
| 94 | 75 | ['priority' => 201, 'filename' => 'customFieldsReset.min.js'], |
| 95 | 76 | ['priority' => 101, 'filename' => 'observeElm.min.js'], |
| 96 | 77 | ], |
| 78 | + 'advanced-file-up' => [ | |
| 79 | + ['priority' => 101, 'filename' => 'observeElm.min.js'], | |
| 80 | + ['priority' => 202, 'filename' => 'bit-filepond.min.js'], | |
| 81 | + ['priority' => 301, 'filename' => 'bit-advanced-file-up-field.min.js'], | |
| 82 | + ['priority' => 101, 'filename' => 'advancedFileHandle.min.js'], | |
| 83 | + ['priority' => 201, 'filename' => 'customFieldsReset.min.js'], | |
| 84 | + ], | |
| 97 | 85 | 'file-up' => [ |
| 98 | 86 | ['priority' => 301, 'filename' => 'bit-file-up-field.min.js'], |
| 99 | 87 | ['priority' => 201, 'filename' => 'customFieldsReset.min.js'], |
| 100 | 88 | ], |
| @@ -101,88 +89,80 @@ | ||
| 101 | 89 | 'phone-number' => [ |
| 102 | 90 | ['priority' => 101, 'filename' => 'observeElm.min.js'], |
| 103 | 91 | ['priority' => 301, 'filename' => 'bit-phone-number-field.min.js'], |
| 104 | 92 | ['priority' => 201, 'filename' => 'customFieldsReset.min.js'], |
| 105 | - // ['priority' => 101, 'filename' => 'observeElm.min.js'], | |
| 93 | + ['priority' => 101, 'filename' => 'observeElm.min.js'], | |
| 106 | 94 | ], |
| 107 | - 'section' => [ | |
| 108 | - ['priority' => 101, 'filename' => 'hideChildFldHandle.min.js'], | |
| 95 | + 'paypal' => [ | |
| 96 | + ['priority' => 201, 'filename' => 'isFormValidatedWithoutError.min.js'], | |
| 97 | + ['priority' => 202, 'filename' => 'saveFormProgress.min.js'], | |
| 98 | + ['priority' => 201, 'filename' => 'customFieldsReset.min.js'], | |
| 99 | + ['priority' => 301, 'filename' => 'bit-paypal-field.min.js'], | |
| 109 | 100 | ], |
| 101 | + 'stripe' => [ | |
| 102 | + ['priority' => 201, 'filename' => 'bitsFetchFront.min.js'], | |
| 103 | + ['priority' => 201, 'filename' => 'isFormValidatedWithoutError.min.js'], | |
| 104 | + ['priority' => 201, 'filename' => 'customFieldsReset.min.js'], | |
| 105 | + ['priority' => 202, 'filename' => 'saveFormProgress.min.js'], | |
| 106 | + ['priority' => 301, 'filename' => 'bit-stripe-field.min.js'], | |
| 107 | + ], | |
| 110 | 108 | 'repeater' => [ |
| 111 | - ['priority' => 101, 'filename' => 'hideChildFldHandle.min.js'], | |
| 112 | - ['priority' => 102, 'filename' => 'bit-repeater-field.min.js'], | |
| 109 | + ['priority' => 301, 'filename' => 'bit-repeater-field.min.js'], | |
| 113 | 110 | ['priority' => 701, 'filename' => 'checkRepeatedField.min.js'], |
| 114 | - ['priority' => 701, 'filename' => 'isRepeaterField.min.js'], | |
| 115 | 111 | ['priority' => 701, 'filename' => 'getRepeatedIndexes.min.js'], |
| 116 | 112 | ['priority' => 701, 'filename' => 'getIndexesBaseOnConditions.min.js'], |
| 117 | 113 | ['priority' => 201, 'filename' => 'customFieldsReset.min.js'], |
| 118 | 114 | ], |
| 115 | + 'razorpay' => [ | |
| 116 | + ['priority' => 201, 'filename' => 'isFormValidatedWithoutError.min.js'], | |
| 117 | + ['priority' => 201, 'filename' => 'customFieldsReset.min.js'], | |
| 118 | + ['priority' => 202, 'filename' => 'saveFormProgress.min.js'], | |
| 119 | + ['priority' => 301, 'filename' => 'bit-razorpay-field.min.js'], | |
| 120 | + ], | |
| 121 | + 'radio' => [ | |
| 122 | + ['priority' => 301, 'filename' => 'OtherOptionJS', 'scriptTyp' => 'custom', 'source' => $customSource, 'path' => 'addOtherOpt'], | |
| 123 | + ], | |
| 124 | + 'check' => [ | |
| 125 | + ['priority' => 301, 'filename' => 'OtherOptionJS', 'scriptTyp' => 'custom', 'source' => $customSource, 'path' => 'addOtherOpt'], | |
| 126 | + ['priority' => 301, 'filename' => 'CheckDisableOnMax', 'scriptTyp' => 'custom', 'source' => $customSource, 'path' => 'valid->disableOnMax'], | |
| 127 | + ], | |
| 128 | + 'image-select' => [ | |
| 129 | + ['priority' => 301, 'filename' => 'CheckDisableOnMax', 'scriptTyp' => 'custom', 'source' => $customSource, 'path' => 'valid->disableOnMax'], | |
| 130 | + ], | |
| 119 | 131 | 'recaptcha' => [ |
| 120 | 132 | ['priority' => 301, 'filename' => 'bit-recaptcha-field.min.js'], |
| 121 | - ['priority' => 302, 'filename' => 'scriptLoader.min.js'], | |
| 122 | - ['priority' => 303, 'filename' => 'initRecaptchaFld.min.js'], | |
| 123 | 133 | ], |
| 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 | 134 | 'decision-box' => [ |
| 134 | 135 | ['priority' => 101, 'filename' => 'decisionFldHandle.min.js'], |
| 135 | 136 | ], |
| 136 | - 'gdpr' => [ | |
| 137 | - ['priority' => 101, 'filename' => 'decisionFldHandle.min.js'], | |
| 137 | + 'signature' => [ | |
| 138 | + ['priority' => 201, 'filename' => 'customFieldsReset.min.js'], | |
| 139 | + ['priority' => 301, 'filename' => 'bit-signature-field.min.js'], | |
| 138 | 140 | ], |
| 139 | 141 | 'rating' => [ |
| 140 | 142 | ['priority' => 201, 'filename' => 'customFieldsReset.min.js'], |
| 141 | 143 | ['priority' => 301, 'filename' => 'bit-rating-field.min.js'], |
| 142 | 144 | ], |
| 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 | 145 | ]; |
| 146 | + } | |
| 179 | 147 | |
| 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); | |
| 148 | + public static function filePondPlugins($plugin) | |
| 149 | + { | |
| 150 | + $plugins = [ | |
| 151 | + 'allowFileSizeValidation' => ['priority' => 201, 'filename' => 'bit-filepond-plugin-file-validate-size.min.js'], | |
| 152 | + 'allowFileTypeValidation' => ['priority' => 201, 'filename' => 'bit-filepond-plugin-file-validate-type.min.js'], | |
| 153 | + 'allowImageCrop' => ['priority' => 201, 'filename' => 'bit-filepond-plugin-image-crop.min.js'], | |
| 154 | + 'allowImagePreview' => ['priority' => 201, 'filename' => 'bit-filepond-plugin-image-preview.min.js'], | |
| 155 | + 'allowImageResize' => ['priority' => 201, 'filename' => 'bit-filepond-plugin-image-resize.min.js'], | |
| 156 | + 'allowImageTransform' => ['priority' => 201, 'filename' => 'bit-filepond-plugin-image-transform.min.js'], | |
| 157 | + 'allowImageValidateSize' => ['priority' => 201, 'filename' => 'bit-filepond-plugin-image-validate-size.min.js'], | |
| 158 | + 'allowPreview' => ['priority' => 201, 'filename' => 'bit-filepond-plugin-media-preview.min.js'], | |
| 159 | + ]; | |
| 160 | + if (array_key_exists($plugin, $plugins)) { | |
| 161 | + return $plugins[$plugin]; | |
| 162 | + } | |
| 163 | + | |
| 164 | + return false; | |
| 185 | 165 | } |
| 186 | 166 | |
| 187 | 167 | public static function getAllFldConfs() |
| 188 | 168 | { |
| @@ -193,127 +173,133 @@ | ||
| 193 | 173 | // var is for variable value |
| 194 | 174 | // path is for field path [ for multiple paths] |
| 195 | 175 | // val is for static value |
| 196 | 176 | $configs = [ |
| 197 | - | |
| 198 | 177 | '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 | - 'searchPlaceholder' => ['path' => 'config->searchPlaceholder', 'val' => ''], | |
| 212 | - 'activeList' => ['path' => 'config->activeList', 'val' => 0], | |
| 178 | + 'fieldKey' => ['var' => 'fieldKey'], | |
| 179 | + 'options' => ['path' => 'optionsList'], | |
| 180 | + 'placeholder' => ['path' => 'ph'], | |
| 181 | + 'classNames' => ['path' => 'customClasses'], | |
| 182 | + 'attributes' => ['path' => 'customAttributes'], | |
| 183 | + 'defaultValue' => ['path' => ['val', 'config->defaultValue'], 'val'=> ''], | |
| 184 | + 'separator' => ['val' => BITFORMS_BF_SEPARATOR], | |
| 185 | + 'mn' => ['path' => 'mn', 'val' => 0], | |
| 186 | + 'mx' => ['path' => 'mx', 'val' => 0], | |
| 187 | + 'disableOnMax' => ['path' => 'valid->disableOnMax', 'val' => false], | |
| 213 | 188 | ], |
| 214 | - 'address' => [ | |
| 215 | - 'config' => (object) [], | |
| 216 | - 'fieldKey' => ['var' => 'fieldKey'], | |
| 217 | - 'contentId' => ['var' => 'contentId'], | |
| 218 | - 'assetsURL' => ['val' => BITFORMS_ROOT_URI . '/static/address/'], | |
| 219 | - 'fieldName' => ['path' => 'fieldName'], | |
| 220 | - 'classNames' => ['path' => 'customClasses'], | |
| 221 | - 'attributes' => ['path' => 'customAttributes'], | |
| 222 | - 'defaultCountry' => ['path' => 'config->defaultCountry', 'val' => ''], | |
| 223 | - 'zipValidation' => ['path' => 'config->zipValidation', 'val' => 'auto'], | |
| 224 | - 'zipCustomRegex' => ['path' => 'config->zipCustomRegex', 'val' => ''], | |
| 225 | - | |
| 226 | - ], | |
| 227 | 189 | 'country' => [ |
| 228 | - 'config' => (object) [], // sentinel: blocks raw fldData.config passthrough; | |
| 229 | - 'fieldKey' => ['var' => 'fieldKey'], | |
| 230 | - 'options' => ['path' => 'options'], | |
| 231 | - 'placeholder' => ['path' => 'ph'], | |
| 232 | - 'assetsURL' => ['val' => BITFORMS_ROOT_URI . '/static/countries/'], | |
| 233 | - 'classNames' => ['path' => 'customClasses'], | |
| 234 | - 'attributes' => ['path' => 'customAttributes'], | |
| 235 | - 'defaultValue' => ['path' => ['val', 'config->defaultValue'], 'val' => ''], | |
| 236 | - 'selectedCountryClearable' => ['path' => 'config->selectedCountryClearable', 'val' => true], | |
| 237 | - 'searchClearable' => ['path' => 'config->searchClearable', 'val' => true], | |
| 238 | - 'searchPlaceholder' => ['path' => 'config->searchPlaceholder', 'val' => ''], | |
| 190 | + 'fieldKey' => ['var' => 'fieldKey'], | |
| 191 | + 'options' => ['path' => 'options'], | |
| 192 | + 'placeholder' => ['path' => 'ph'], | |
| 193 | + 'assetsURL' => ['val' => BITFORMS_ROOT_URI . '/static/countries/'], | |
| 194 | + 'classNames' => ['path' => 'customClasses'], | |
| 195 | + 'attributes' => ['path' => 'customAttributes'], | |
| 196 | + 'defaultValue' => ['path' => ['val', 'config->defaultValue'], 'val'=> ''], | |
| 239 | 197 | ], |
| 240 | 198 | 'currency' => [ |
| 241 | - 'config' => (object) [], // sentinel: blocks raw fldData.config | |
| 242 | - 'fieldKey' => ['var' => 'fieldKey'], | |
| 243 | - 'options' => ['path' => 'options'], | |
| 244 | - 'assetsURL' => ['val' => BITFORMS_ROOT_URI . '/static/currencies/'], | |
| 245 | - 'classNames' => ['path' => 'customClasses'], | |
| 246 | - 'attributes' => ['path' => 'customAttributes'], | |
| 247 | - 'defaultValue' => ['path' => ['val', 'config->defaultValue'], 'val' => ''], | |
| 248 | - 'selectedCurrencyClearable' => ['path' => 'config->selectedCurrencyClearable', 'val' => true], | |
| 249 | - 'searchClearable' => ['path' => 'config->searchClearable', 'val' => true], | |
| 250 | - 'searchPlaceholder' => ['path' => 'config->searchPlaceholder', 'val' => ''], | |
| 199 | + 'fieldKey' => ['var' => 'fieldKey'], | |
| 200 | + 'options' => ['path' => 'options'], | |
| 201 | + 'assetsURL' => ['val' => BITFORMS_ROOT_URI . '/static/currencies/'], | |
| 202 | + 'classNames' => ['path' => 'customClasses'], | |
| 203 | + 'attributes' => ['path' => 'customAttributes'], | |
| 204 | + 'defaultValue' => ['path' => ['val', 'config->defaultValue'], 'val'=> ''], | |
| 251 | 205 | ], |
| 252 | 206 | 'phone-number' => [ |
| 253 | - 'config' => (object) [], // sentinel: blocks raw fldData.config passthrough; | |
| 254 | - 'fieldKey' => ['var' => 'fieldKey'], | |
| 255 | - 'options' => ['path' => 'options'], | |
| 256 | - 'assetsURL' => ['val' => BITFORMS_ROOT_URI . '/static/countries/'], | |
| 257 | - 'classNames' => ['path' => 'customClasses'], | |
| 258 | - 'attributes' => ['path' => 'customAttributes'], | |
| 259 | - 'contentId' => ['var' => 'contentId'], | |
| 260 | - 'selectedCountryClearable' => ['path' => 'config->selectedCountryClearable', 'val' => true], | |
| 261 | - 'searchClearable' => ['path' => 'config->searchClearable', 'val' => true], | |
| 262 | - 'searchPlaceholder' => ['path' => 'config->searchPlaceholder', 'val' => ''], | |
| 207 | + 'fieldKey' => ['var' => 'fieldKey'], | |
| 208 | + 'options' => ['path' => 'options'], | |
| 209 | + 'assetsURL' => ['val' => BITFORMS_ROOT_URI . '/static/countries/'], | |
| 210 | + 'classNames' => ['path' => 'customClasses'], | |
| 211 | + 'attributes' => ['path' => 'customAttributes'] | |
| 263 | 212 | ], |
| 264 | 213 | 'file-up' => [ |
| 265 | - 'config' => (object) [], // sentinel: blocks raw fldData.config passthrough; | |
| 266 | - 'fieldKey' => ['var' => 'fieldKey'], | |
| 267 | - 'formID' => ['var' => 'formId'], | |
| 268 | - 'maxSizeErrMsg' => ['path' => ['err->maxSize->msg', 'err->maxSize->dflt']], | |
| 269 | - 'minFileErrMsg' => ['path' => ['err->minFile->msg', 'err->minFile->dflt']], | |
| 270 | - 'maxFileErrMsg' => ['path' => ['err->maxFile->msg', 'err->maxFile->dflt']], | |
| 271 | - 'assetsURL' => ['val' => BITFORMS_ROOT_URI . '/static/file-upload/'], | |
| 272 | - 'classNames' => ['path' => 'customClasses'], | |
| 273 | - 'attributes' => ['path' => 'customAttributes'], | |
| 274 | - 'fieldName' => ['path' => 'fieldName'], | |
| 275 | - 'contentId' => ['var' => 'contentId'], | |
| 276 | - 'multiple' => ['path' => 'config->multiple', 'val' => false], | |
| 277 | - 'allowMaxSize' => ['path' => 'config->allowMaxSize', 'val' => false], | |
| 278 | - 'maxSize' => ['path' => 'config->maxSize', 'val' => 0], | |
| 279 | - 'sizeUnit' => ['path' => 'config->sizeUnit', 'val' => 'KB'], | |
| 280 | - 'isItTotalMax' => ['path' => 'config->isItTotalMax', 'val' => false], | |
| 281 | - 'allowedFileType' => ['path' => 'config->allowedFileType', 'val' => ''], | |
| 282 | - 'minFile' => ['path' => 'config->minFile', 'val' => 0], | |
| 283 | - 'maxFile' => ['path' => 'config->maxFile', 'val' => 0], | |
| 284 | - 'showSelectStatus' => ['path' => 'config->showSelectStatus', 'val' => false], | |
| 285 | - 'fileSelectStatus' => ['path' => 'config->fileSelectStatus', 'val' => 'No File Selected'], | |
| 286 | - 'fileExistMsg' => ['val' => 'A file already exist'], | |
| 287 | - 'showFileList' => ['path' => 'config->showFileList', 'val' => false], | |
| 288 | - 'showFilePreview' => ['path' => 'config->showFilePreview', 'val' => false], | |
| 289 | - 'showFileSize' => ['path' => 'config->showFileSize', 'val' => false], | |
| 290 | - 'fileExistMsg' => ['path' => 'config->fileExistMsg', 'val' => 'A file already exist'], | |
| 214 | + 'fieldKey' => ['var' => 'fieldKey'], | |
| 215 | + 'formID' => ['var' => 'formId'], | |
| 216 | + 'maxSizeErrMsg' => ['path' => ['err->maxSize->msg', 'err->maxSize->dflt']], | |
| 217 | + 'minFileErrMsg' => ['path' => ['err->minFile->msg', 'err->minFile->dflt']], | |
| 218 | + 'maxFileErrMsg' => ['path' => ['err->maxFile->msg', 'err->maxFile->dflt']], | |
| 219 | + 'assetsURL' => ['val' => BITFORMS_ROOT_URI . '/static/file-upload/'], | |
| 220 | + 'classNames' => ['path' => 'customClasses'], | |
| 221 | + 'attributes' => ['path' => 'customAttributes'], | |
| 222 | + 'fieldName' => ['path' => 'fieldName'], | |
| 291 | 223 | ], |
| 224 | + 'paypal' => [ | |
| 225 | + 'payIntegID' => ['path' => 'payIntegID'], | |
| 226 | + 'style' => ['path' => 'style'], | |
| 227 | + 'currency' => ['path' => 'currency', 'val' => 'USD'], | |
| 228 | + 'amount' => ['path' => 'amount', 'val' => 0], | |
| 229 | + 'amountFld' => ['path' => 'amountFld', 'val' => ''], | |
| 230 | + 'shipping' => ['path' => 'shipping', 'val' => 0], | |
| 231 | + 'shippingVal' => ['path' => 'shippingFld', 'val' => ''], | |
| 232 | + 'tax' => ['path' => 'tax', 'val' => 0], | |
| 233 | + 'taxVal' => ['path' => 'taxFld', 'val' => ''], | |
| 234 | + 'description' => ['path' => 'description', 'val' => ''], | |
| 235 | + 'descFld' => ['path' => 'descFld', 'val' => ''], | |
| 236 | + 'payType' => ['path' => 'payType', 'val' => 'payment'], | |
| 237 | + 'planId' => ['path' => 'planId', 'val' => ''], | |
| 238 | + 'locale' => ['path' => 'locale', 'val' => 'en_US'], | |
| 239 | + 'disableFunding' => ['path' => 'disableFunding', 'val' => ''], | |
| 240 | + 'fieldKey' => ['var' => 'fieldKey'], | |
| 241 | + 'clientId' => ['path' => 'clientId'], | |
| 242 | + 'contentId' => ['var' => 'contentId'], | |
| 243 | + 'namespace' => ['val' => 'bit-paypal-__$contentId__'], | |
| 244 | + ], | |
| 245 | + 'stripe' => [ | |
| 246 | + 'payIntegID' => ['path' => 'payIntegID'], | |
| 247 | + 'locale' => ['path' => 'config->options->locale', 'val' => 'en'], | |
| 248 | + 'amountType' => ['path' => 'config->amountType', 'val'=> 'fixed'], | |
| 249 | + 'fieldKey' => ['var' => 'fieldKey'], | |
| 250 | + 'contentId' => ['var' => 'contentId'], | |
| 251 | + 'publishableKey' => ['path' => 'publishableKey'], | |
| 252 | + ], | |
| 253 | + 'advanced-file-up' => [ | |
| 254 | + 'fieldKey' => ['var' => 'fieldKey'], | |
| 255 | + 'formID' => ['var' => 'formId'], | |
| 256 | + 'configSetting' => ['path' => 'config'], | |
| 257 | + 'ajaxURL' => ['val' => admin_url('admin-ajax.php')], | |
| 258 | + 'nonce' => ['val' => wp_create_nonce('bitforms_save')], | |
| 259 | + 'uploadFileToServer' => ['val' => 1], | |
| 260 | + 'fieldName' => ['path' => 'fieldName'], | |
| 261 | + ], | |
| 262 | + 'razorpay' => [ | |
| 263 | + 'fieldKey' => ['var' => 'fieldKey'], | |
| 264 | + 'options' => ['path' => 'options'], | |
| 265 | + 'payIntegID' => ['path' => 'payIntegID'], | |
| 266 | + 'payType' => ['path' =>'payType', 'val' => ''], | |
| 267 | + 'clientId' => ['path' => 'clientId'], | |
| 268 | + 'contentId' => ['var' => 'contentId'], | |
| 269 | + ], | |
| 292 | 270 | 'repeater' => [ |
| 293 | - 'config' => (object) [], | |
| 294 | - 'fieldKey' => ['var' => 'fieldKey'], | |
| 295 | - 'fieldName' => ['path' => 'fieldName'], | |
| 296 | - 'contentId' => ['var' => 'contentId'], | |
| 297 | - 'showAddBtn' => ['path' => 'addBtn->show', 'val' => false], | |
| 298 | - 'showAddToEndBtn' => ['path' => 'addToEndBtn->show', 'val' => false], | |
| 299 | - 'defaultValue' => ['path' => 'val', 'val' => ''], | |
| 271 | + 'fieldKey' => ['var' => 'fieldKey'], | |
| 272 | + 'fieldName' => ['path' => 'fieldName'], | |
| 273 | + 'contentId' => ['var' => 'contentId'], | |
| 274 | + 'defaultRow' => ['path' => 'defaultRow', 'val' => 1], | |
| 275 | + 'minimumRow' => ['path' => 'minRow', 'val' => 1], | |
| 276 | + 'maximumRow' => ['path' => 'maxRow', 'val' => 0], | |
| 277 | + 'showAddBtn' => ['path' => 'addBtn->show', 'val' => false], | |
| 278 | + 'showAddToEndBtn' => ['path' => 'addToEndBtn->show', 'val' => false], | |
| 279 | + 'defaultValue' => ['path' => 'val', 'val' => ''], | |
| 300 | 280 | ], |
| 281 | + 'signature' => [ | |
| 282 | + 'fieldKey' => ['var' => 'fieldKey'], | |
| 283 | + 'contentId' => ['var' => 'contentId'], | |
| 284 | + 'maxWidth' => ['path' => 'config->maxWidth', 'val' => '1'], | |
| 285 | + 'penColor' => ['path' => 'config->penColor', 'val'=> '#000000'], | |
| 286 | + 'backgroundColor' => ['path' => 'config->backgroundColor', 'val' => '#ffffff'], | |
| 287 | + 'imgTyp' => ['path' => 'config->imgTyp', 'val' => 'image/png'], | |
| 288 | + 'assetsURL' => ['val' => BITFORMS_ROOT_URI . '/static/signature/'] | |
| 289 | + ], | |
| 301 | 290 | 'rating' => [ |
| 302 | 291 | 'fieldKey' => ['var' => 'fieldKey'], |
| 303 | 292 | 'contentId' => ['var' => 'contentId'], |
| 304 | 293 | 'options' => ['path' => 'opt'], |
| 294 | + 'showReviewLblOnHover' => ['path' => 'showReviewLblOnHover'], | |
| 295 | + 'showReviewLblOnSelect' => ['path' => 'showReviewLblOnSelect'], | |
| 305 | 296 | 'selectedRating' => ['path' => 'selectedRating'], |
| 306 | 297 | 'defaultValue' => ['path' => ['val', 'config->defaultValue'], 'val'=> ''], |
| 307 | - ], | |
| 308 | - 'hcaptcha'=> [ | |
| 309 | - 'fieldKey' => ['var'=>'fieldKey'] | |
| 310 | - ], | |
| 298 | + ] | |
| 311 | 299 | ]; |
| 312 | - /** | |
| 313 | - * Allow add-on plugins to extend field config mappings. | |
| 314 | - */ | |
| 315 | - return apply_filters('bitform_field_config_paths', $configs); | |
| 300 | + | |
| 301 | + return $configs; | |
| 316 | 302 | } |
| 317 | 303 | |
| 318 | 304 | public static function multiStepFiles() |
| 319 | 305 | { |
| @@ -324,17 +310,8 @@ | ||
| 324 | 310 | ['priority' => 700, 'filename' => 'bit-multi-step-form.min.js'], |
| 325 | 311 | ]; |
| 326 | 312 | } |
| 327 | 313 | |
| 328 | - public static function conversationalFormFiles() | |
| 329 | - { | |
| 330 | - return [ | |
| 331 | - ['priority' => 202, 'filename' => 'saveFormProgress.min.js'], | |
| 332 | - ['priority' => 700, 'filename' => 'bit-conversational-form.min.js'], | |
| 333 | - ['priority' => 700, 'filename' => 'handleConversationalFormMsg.min.js'], | |
| 334 | - ]; | |
| 335 | - } | |
| 336 | - | |
| 337 | 314 | public static function frontendScriptFile() |
| 338 | 315 | { |
| 339 | 316 | return [ |
| 340 | 317 | 'observeElm' => ['priority' => 101, 'filename' => 'observeElm.min.js'], |
| @@ -341,50 +318,33 @@ | ||
| 341 | 318 | 'hidden-token-field' => ['priority' => 300, 'filename' => 'hidden-token-field.min.js'], |
| 342 | 319 | ]; |
| 343 | 320 | } |
| 344 | 321 | |
| 345 | - public static function validationAndOtherScriptFile() | |
| 322 | + public static function validationScriptFile() | |
| 346 | 323 | { |
| 347 | - $files = [ | |
| 348 | - 'confirmFldMatch' => ['priority' => 701, 'filename' => 'confirmFldMatch.min.js'], | |
| 349 | - 'checkFldValidation' => ['priority' => 701, 'filename' => 'checkFldValidation.min.js'], | |
| 350 | - // 'checkMinMaxOptions' => ['priority' => 702, 'filename' => 'checkMinMaxOptions.min.js'], | |
| 351 | - // 'bfDatetimeFldValidation' => ['priority' => 702, 'filename' => 'bfDatetimeFldValidation.min.js'], | |
| 352 | - 'bfParseDateTime' => ['priority' => 301, 'filename' => 'bfParseDateTime.min.js'], | |
| 353 | - 'checkMinMaxValue' => ['priority' => 702, 'filename' => 'checkMinMaxValue.min.js'], | |
| 354 | - 'textLengthValidation' => ['priority' => 702, 'filename' => 'textLengthValidation.min.js'], | |
| 355 | - 'customOptionValidation' => ['priority' => 702, 'filename' => 'customOptionValidation.min.js'], | |
| 356 | - 'dcsnbxFldValidation' => ['priority' => 702, 'filename' => 'dcsnbxFldValidation.min.js'], | |
| 357 | - 'emailFldValidation' => ['priority' => 702, 'filename' => 'emailFldValidation.min.js'], | |
| 358 | - 'fileupFldValidation' => ['priority' => 702, 'filename' => 'fileupFldValidation.min.js'], | |
| 359 | - 'advanceFileupFldValidation' => ['priority' => 702, 'filename' => 'advanceFileUpFldValidation.min.js'], | |
| 360 | - 'phoneNumberFldValidation' => ['priority' => 702, 'filename' => 'phoneNumberFldValidation.min.js'], | |
| 361 | - 'currencyFldValidation' => ['priority' => 702, 'filename' => 'currencyFldValidation.min.js'], | |
| 362 | - 'addressZipFldValidation' => ['priority' => 702, 'filename' => 'addressZipFldValidation.min.js'], | |
| 363 | - 'generateBackslashPattern' => ['priority' => 700, 'filename' => 'generateBackslashPattern.min.js'], | |
| 364 | - // 'nmbrFldValidation' => ['priority' => 702, 'filename' => 'nmbrFldValidation.min.js'], | |
| 365 | - // 'regexPatternValidation' => ['priority' => 701, 'filename' => 'regexPatternValidation.min.js'], // load before generateBackslashPattern file, then load regexPatternValidation | |
| 366 | - 'inputMaskValidation' => ['priority' => 701, 'filename' => 'inputMaskValidation.min.js'], // load before generateBackslashPattern file, then load inputMaskValidation | |
| 367 | - 'bit-input-mask' => ['priority' => 701, 'filename' => 'bit-input-mask.min.js'], // load before generateBackslashPattern file, then load bit-input-mask | |
| 368 | - 'setBitInputMaskToInput' => ['priority' => 702, 'filename' => 'setBitInputMaskToInput.min.js'], // load before generateBackslashPattern file, then load setBitInputMaskToInput | |
| 369 | - 'requiredFldValidation' => ['priority' => 700, 'filename' => 'requiredFldValidation.min.js'], | |
| 370 | - 'urlFldValidation' => ['priority' => 702, 'filename' => 'urlFldValidation.min.js'], | |
| 371 | - 'validation' => ['priority' => 705, 'filename' => 'validateForm.min.js'], // last priority for validation script | |
| 372 | - 'conditionalLogic' => ['priority' => 705, 'filename' => 'bit-conditionals.min.js'], // last priority for validation script | |
| 373 | - 'resetPlaceholders' => ['priority' => 201, 'filename' => 'resetPlaceholders.min.js'], | |
| 374 | - 'bfResetDefaultValue' => ['priority' => 201, 'filename' => 'bfResetDefaultValue.min.js'], | |
| 375 | - 'validateFocusLost' => ['priority' => 706, 'filename' => 'validate-focus.min.js'], // last priority for validation script | |
| 324 | + return [ | |
| 325 | + 'checkFldValidation' => ['priority' => 701, 'filename' => 'checkFldValidation.min.js'], | |
| 326 | + 'checkMinMaxOptions' => ['priority' => 702, 'filename' => 'checkMinMaxOptions.min.js'], | |
| 327 | + 'customOptionValidation' => ['priority' => 702, 'filename' => 'customOptionValidation.min.js'], | |
| 328 | + 'dcsnbxFldValidation' => ['priority' => 702, 'filename' => 'dcsnbxFldValidation.min.js'], | |
| 329 | + 'emailFldValidation' => ['priority' => 702, 'filename' => 'emailFldValidation.min.js'], | |
| 330 | + 'fileupFldValidation' => ['priority' => 702, 'filename' => 'fileupFldValidation.min.js'], | |
| 331 | + 'advanceFileupFldValidation' => ['priority' => 702, 'filename' => 'advanceFileUpFldValidation.min.js'], | |
| 332 | + 'phoneNumberFldValidation' => ['priority' => 702, 'filename' => 'phoneNumberFldValidation.min.js'], | |
| 333 | + 'generateBackslashPattern' => ['priority' => 700, 'filename' => 'generateBackslashPattern.min.js'], | |
| 334 | + 'nmbrFldValidation' => ['priority' => 702, 'filename' => 'nmbrFldValidation.min.js'], | |
| 335 | + 'regexPatternValidation' => ['priority' => 701, 'filename' => 'regexPatternValidation.min.js'], // load before generateBackslashPattern file, then load regexPatternValidation | |
| 336 | + 'requiredFldValidation' => ['priority' => 700, 'filename' => 'requiredFldValidation.min.js'], | |
| 337 | + 'urlFldValidation' => ['priority' => 702, 'filename' => 'urlFldValidation.min.js'], | |
| 338 | + 'validation' => ['priority' => 705, 'filename' => 'validateForm.min.js'], // last priority for validation script | |
| 339 | + 'conditionalLogic' => ['priority' => 705, 'filename' => 'bit-conditionals.min.js'], // last priority for validation script | |
| 340 | + 'validateFocusLost' => ['priority' => 706, 'filename' => 'validate-focus.min.js'], // last priority for validation script | |
| 376 | 341 | ]; |
| 377 | - | |
| 378 | - /** | |
| 379 | - * Allow add-on plugins to register additional validation scripts. | |
| 380 | - */ | |
| 381 | - return apply_filters('bitform_validation_and_other_script_files', $files); | |
| 382 | 342 | } |
| 383 | 343 | |
| 384 | 344 | public static function validationScriptFileMapping($fieldType) |
| 385 | 345 | { |
| 386 | - $textTypeField = ['text', 'password', 'username', 'color']; | |
| 346 | + $textTypeField = ['text', 'password', 'username', 'date', 'datetime-local', 'time', 'month', 'week', 'color']; | |
| 387 | 347 | if (in_array($fieldType, $textTypeField)) { |
| 388 | 348 | $fieldType = 'text'; |
| 389 | 349 | } |
| 390 | 350 | $fields = |
| @@ -389,53 +349,15 @@ | ||
| 389 | 349 | } |
| 390 | 350 | $fields = |
| 391 | 351 | [ |
| 392 | 352 | 'text' => [ |
| 393 | - 'bit-input-mask' => [ | |
| 394 | - 'paths' => ['valid->inputMask'], | |
| 395 | - ], | |
| 396 | - 'inputMaskValidation' => [ | |
| 397 | - 'paths' => ['valid->inputMask'], | |
| 353 | + 'regexPatternValidation' => [ | |
| 354 | + 'paths' => ['valid->regexr'], | |
| 398 | 355 | 'dependencies' => [ |
| 399 | - 'generateBackslashPattern', | |
| 400 | - 'validation', | |
| 356 | + 'generateBackslashPattern' | |
| 401 | 357 | ] |
| 402 | - ], | |
| 403 | - 'setBitInputMaskToInput' => [ | |
| 404 | - 'paths' => ['valid->inputMask'], | |
| 405 | - 'dependencies' => [ | |
| 406 | - 'bit-input-mask' | |
| 407 | - ] | |
| 408 | - ], | |
| 409 | - 'textLengthValidation' => [ | |
| 410 | - 'paths' => ['valid->minlength', 'valid->maxlength', 'valid->minword', 'valid->maxword'] | |
| 411 | - ], | |
| 412 | - 'confirmFldMatch' => [ | |
| 413 | - 'paths' => ['parentFieldKey'], | |
| 414 | 358 | ] |
| 415 | - | |
| 416 | 359 | ], |
| 417 | - 'textarea' => [ | |
| 418 | - 'bit-input-mask' => [ | |
| 419 | - 'paths' => ['valid->inputMask'], | |
| 420 | - ], | |
| 421 | - 'inputMaskValidation' => [ | |
| 422 | - 'paths' => ['valid->inputMask'], | |
| 423 | - 'dependencies' => [ | |
| 424 | - 'generateBackslashPattern', | |
| 425 | - 'validation', | |
| 426 | - ] | |
| 427 | - ], | |
| 428 | - 'setBitInputMaskToInput' => [ | |
| 429 | - 'paths' => ['valid->inputMask'], | |
| 430 | - 'dependencies' => [ | |
| 431 | - 'bit-input-mask' | |
| 432 | - ] | |
| 433 | - ], | |
| 434 | - 'textLengthValidation' => [ | |
| 435 | - 'paths' => ['valid->minlength', 'valid->maxlength', 'valid->minword', 'valid->maxword'] | |
| 436 | - ] | |
| 437 | - ], | |
| 438 | 360 | 'email' => [ |
| 439 | 361 | 'emailFldValidation' => [ |
| 440 | 362 | 'paths' => ['err->invalid->show'], |
| 441 | 363 | 'dependencies' => [ |
| @@ -441,11 +363,8 @@ | ||
| 441 | 363 | 'dependencies' => [ |
| 442 | 364 | 'generateBackslashPattern' |
| 443 | 365 | ] |
| 444 | 366 | ], |
| 445 | - 'confirmFldMatch' => [ | |
| 446 | - 'paths' => ['parentFieldKey'], | |
| 447 | - ] | |
| 448 | 367 | ], |
| 449 | 368 | 'number' => [ |
| 450 | 369 | 'nmbrFldValidation' => [ |
| 451 | 370 | 'paths' => ['mn', 'mx'] |
| @@ -450,35 +369,52 @@ | ||
| 450 | 369 | 'nmbrFldValidation' => [ |
| 451 | 370 | 'paths' => ['mn', 'mx'] |
| 452 | 371 | ] |
| 453 | 372 | ], |
| 454 | - 'range' => [ | |
| 455 | - 'checkMinMaxValue' => [ | |
| 456 | - 'paths' => ['mn', 'mx'] | |
| 373 | + 'radio' => [ | |
| 374 | + 'customOptionValidation' => [ | |
| 375 | + 'paths' => ['valid->otherOptReq'], | |
| 457 | 376 | ] |
| 458 | 377 | ], |
| 459 | - 'url' => [ | |
| 460 | - 'urlFldValidation' => [ | |
| 461 | - 'paths' => ['err->invalid->show'], | |
| 378 | + 'check' => [ | |
| 379 | + 'checkMinMaxOptions' => [ | |
| 380 | + 'paths' => ['mn', 'mx'], | |
| 462 | 381 | 'dependencies' => [ |
| 463 | - 'generateBackslashPattern' | |
| 382 | + 'checkFldValidation' | |
| 464 | 383 | ] |
| 465 | 384 | ], |
| 466 | - 'bit-input-mask' => [ | |
| 467 | - 'paths' => ['valid->inputMask'], | |
| 385 | + 'customOptionValidation' => [ | |
| 386 | + 'paths' => ['valid->otherOptReq'], | |
| 387 | + ] | |
| 388 | + ], | |
| 389 | + 'select' => [ | |
| 390 | + 'checkMinMaxOptions' => [ | |
| 391 | + 'paths' => ['mn', 'mx'], | |
| 392 | + 'dependencies' => [ | |
| 393 | + 'checkFldValidation' | |
| 394 | + ] | |
| 468 | 395 | ], |
| 469 | - 'inputMaskValidation' => [ | |
| 470 | - 'paths' => ['valid->inputMask'], | |
| 396 | + ], | |
| 397 | + 'image-select' => [ | |
| 398 | + 'checkMinMaxOptions' => [ | |
| 399 | + 'paths' => ['mn', 'mx'], | |
| 471 | 400 | 'dependencies' => [ |
| 472 | - 'generateBackslashPattern', | |
| 473 | - 'validation', | |
| 401 | + 'checkFldValidation' | |
| 474 | 402 | ] |
| 475 | 403 | ], |
| 476 | - 'setBitInputMaskToInput' => [ | |
| 477 | - 'paths' => ['valid->inputMask'], | |
| 404 | + ], | |
| 405 | + 'url' => [ | |
| 406 | + 'regexPatternValidation' => [ | |
| 407 | + 'paths' => ['valid->regexr'], | |
| 478 | 408 | 'dependencies' => [ |
| 479 | - 'bit-input-mask' | |
| 409 | + 'generateBackslashPattern' | |
| 480 | 410 | ] |
| 411 | + ], | |
| 412 | + 'urlFldValidation' => [ | |
| 413 | + 'paths' => ['err->invalid->show'], | |
| 414 | + 'dependencies' => [ | |
| 415 | + 'generateBackslashPattern' | |
| 416 | + ] | |
| 481 | 417 | ] |
| 482 | 418 | ], |
| 483 | 419 | 'decision-box' => [ |
| 484 | 420 | 'dcsnbxFldValidation' => [ |
| @@ -484,15 +420,15 @@ | ||
| 484 | 420 | 'dcsnbxFldValidation' => [ |
| 485 | 421 | 'paths' => ['valid->req'] |
| 486 | 422 | ] |
| 487 | 423 | ], |
| 488 | - 'gdpr' => [ | |
| 489 | - 'dcsnbxFldValidation' => [ | |
| 424 | + 'file-up' => [ | |
| 425 | + 'fileupFldValidation' => [ | |
| 490 | 426 | 'paths' => ['valid->req'] |
| 491 | 427 | ] |
| 492 | 428 | ], |
| 493 | - 'file-up' => [ | |
| 494 | - 'fileupFldValidation' => [ | |
| 429 | + 'advanced-file-up' => [ | |
| 430 | + 'advanceFileupFldValidation' => [ | |
| 495 | 431 | 'paths' => ['valid->req'] |
| 496 | 432 | ] |
| 497 | 433 | ], |
| 498 | 434 | 'phone-number' => [ |
| @@ -499,21 +435,28 @@ | ||
| 499 | 435 | 'phoneNumberFldValidation' => [ |
| 500 | 436 | 'paths' => ['err->invalid->show'], |
| 501 | 437 | ] |
| 502 | 438 | ], |
| 503 | - 'address' => [ | |
| 504 | - 'addressZipFldValidation' => [ | |
| 505 | - 'paths' => ['config->zipValidation'], | |
| 506 | - 'dependencies' => [ | |
| 507 | - 'validation', | |
| 508 | - ] | |
| 509 | - ] | |
| 510 | - ], | |
| 511 | 439 | ]; |
| 512 | - $mapping = isset($fields[$fieldType]) ? $fields[$fieldType] : []; | |
| 440 | + return isset($fields[$fieldType]) ? $fields[$fieldType] : []; | |
| 441 | + } | |
| 513 | 442 | |
| 514 | - /** | |
| 515 | - * Allow pro add-ons to extend/override mapping per field type. | |
| 516 | - */ | |
| 517 | - return apply_filters('bitform_field_validation_script_file_mapping', $mapping, $fieldType); | |
| 443 | + public static function formAbandonmentNeededFiles($abandonType = null) | |
| 444 | + { | |
| 445 | + $files = [ | |
| 446 | + 'draftButton' => [ | |
| 447 | + ['priority' => 401, 'filename' => 'saveDraftButtonEvent.js'] | |
| 448 | + ], | |
| 449 | + 'autoSave' => [ | |
| 450 | + ['priority' => 201, 'filename' => 'bit-page-lifecycle.min.js'], | |
| 451 | + ['priority' => 402, 'filename' => 'autoSavePartial.min.js'], | |
| 452 | + ] | |
| 453 | + ]; | |
| 454 | + | |
| 455 | + $required = [ | |
| 456 | + ['priority' => 402, 'filename' => 'bit-form-abandonment.min.js'], | |
| 457 | + ['priority' => 401, 'filename' => 'saveFormProgress.min.js'], | |
| 458 | + ['priority' => 701, 'filename' => 'setFieldValues.min.js'], | |
| 459 | + ]; | |
| 460 | + return isset($files[$abandonType]) ? array_merge($files[$abandonType], $required) : $required; | |
| 518 | 461 | } |
| 519 | 462 | } |