| @@ -1,10 +1,12 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | namespace BitCode\BitForm\Core\Migration; |
| 4 | 4 | |
| 5 | -class FieldsConversionFormate { | |
| 6 | - public static function getFormate($fieldType) { | |
| 5 | +class FieldsConversionFormate | |
| 6 | +{ | |
| 7 | + public static function getFormate($fieldType) | |
| 8 | + { | |
| 7 | 9 | $formate = [ |
| 8 | 10 | 'button' => [ |
| 9 | 11 | 'unchangeProperty'=> ['typ', 'valid', 'btnSiz', 'btnTyp', 'txt', 'fulW'], |
| 10 | 12 | 'changedProperty' => [], |
| @@ -59,9 +61,9 @@ | ||
| 59 | 61 | ], |
| 60 | 62 | 'removeProperty' => [] |
| 61 | 63 | ], |
| 62 | 64 | 'check' => [ |
| 63 | - 'unchangeProperty'=> ['typ', 'lbl', 'opt', 'valid', 'err', 'adminLbl', 'mn', 'mx'], | |
| 65 | + 'unchangeProperty'=> ['typ', 'lbl', 'opt', 'valid', 'err', 'adminLbl', 'mn', 'mx', 'customType'], | |
| 64 | 66 | 'changedProperty' => [], |
| 65 | 67 | 'newProperty' => [ |
| 66 | 68 | 'valid->reqShow' => true, |
| 67 | 69 | 'valid->reqPos' => 'after', |
| @@ -74,9 +76,9 @@ | ||
| 74 | 76 | ], |
| 75 | 77 | 'removeProperty' => ['round'] |
| 76 | 78 | ], |
| 77 | 79 | 'radio' => [ |
| 78 | - 'unchangeProperty'=> ['typ', 'lbl', 'opt', 'valid', 'err', 'adminLbl'], | |
| 80 | + 'unchangeProperty'=> ['typ', 'lbl', 'opt', 'valid', 'err', 'adminLbl', 'customType'], | |
| 79 | 81 | 'changedProperty' => [], |
| 80 | 82 | 'newProperty' => [ |
| 81 | 83 | 'valid->reqShow' => true, |
| 82 | 84 | 'valid->reqPos' => 'after', |
| @@ -165,9 +167,9 @@ | ||
| 165 | 167 | 'customAttributes' => (object)[], |
| 166 | 168 | 'fieldName' => 'file-up', |
| 167 | 169 | 'phHide' => true, |
| 168 | 170 | 'adminLblHide' => true, |
| 169 | - 'prefixIcn' => str_replace('/v1', '', BITFORMS_ASSET_URI) . '/../static/file-upload/paperclip.svg', | |
| 171 | + 'prefixIcn' => BITFORMS_ROOT_URI . '/static/file-upload/paperclip.svg', | |
| 170 | 172 | 'btnTxt' => 'Attach File', |
| 171 | 173 | 'config' => [ |
| 172 | 174 | 'multiple' => false, |
| 173 | 175 | 'allowMaxSize' => true, |
| @@ -291,8 +293,9 @@ | ||
| 291 | 293 | ], |
| 292 | 294 | 'opt' => [['path' => 'optionsList->0->List-1']], |
| 293 | 295 | 'customOpt' => [['path' => 'config->allowCustomOption']], |
| 294 | 296 | 'ph' => [['path' => 'ph', 'val' => 'Select...']], |
| 297 | + 'customType'=> [['path' => 'customTypeList->0']], | |
| 295 | 298 | ], |
| 296 | 299 | 'newProperty' => [ |
| 297 | 300 | 'valid->reqShow' => true, |
| 298 | 301 | 'valid->reqPos' => 'after', |
| @@ -307,8 +310,9 @@ | ||
| 307 | 310 | 'config' => [ |
| 308 | 311 | 'selectedOptImage' => false, |
| 309 | 312 | 'selectedOptClearable'=> true, |
| 310 | 313 | 'searchClearable' => true, |
| 314 | + 'showSearch' => true, | |
| 311 | 315 | 'optionIcon' => false, |
| 312 | 316 | 'placeholder' => 'Select an option', |
| 313 | 317 | 'showSearchPh' => true, |
| 314 | 318 | 'searchPlaceholder' => 'Search options..', |
| @@ -433,7 +437,9 @@ | ||
| 433 | 437 | 'removeProperty' => ['options->payIntegID'] |
| 434 | 438 | ], |
| 435 | 439 | ]; |
| 436 | 440 | |
| 437 | - return $formate[$fieldType]; | |
| 441 | + // Unknown field type must not fatal mid-migration (undefined index + | |
| 442 | + // null dereference in the caller would leave form_content half-migrated) | |
| 443 | + return isset($formate[$fieldType]) ? $formate[$fieldType] : null; | |
| 438 | 444 | } |
| 439 | 445 | } |