| @@ -24,9 +24,9 @@ | ||
| 24 | 24 | $formData = (object)[]; |
| 25 | 25 | $formData->form_id = $newFormId; |
| 26 | 26 | $formData->fields = (object) $data['form_content']['fields']; |
| 27 | 27 | $formData->layout = $data['form_content']['layout']; |
| 28 | - $formData->nestedLayout = $data['form_content']['nestedLayout']; | |
| 28 | + $formData->nestedLayouts = $data['form_content']['nestedLayout']; | |
| 29 | 29 | $formData->form_name = $formName; |
| 30 | 30 | $formData->formInfo = isset($data['form_content']['formInfo']) ? $data['form_content']['formInfo'] : (object)[]; |
| 31 | 31 | |
| 32 | 32 | if (isset($data['formSettings'])) { |
| @@ -42,13 +42,24 @@ | ||
| 42 | 42 | $integrations = \preg_replace('/(\${bf?)(\d+)([- \d]+\})/', '${1}' . $newFormId . '$3', $integrations); |
| 43 | 43 | $formSettings['integrations'] = json_decode(\preg_replace('/(\"formField\"\s*\:\s*\"bf?)(\d+)([- \d]+)/', '${1}' . $newFormId . '$3', $integrations)); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | + if (isset($formSettings['formAbandonment'])) { | |
| 47 | + $formAbandonment = !is_string($formSettings['formAbandonment']) ? wp_json_encode($formSettings['formAbandonment']) : $formSettings['formAbandonment']; | |
| 48 | + $formSettings['formAbandonment'] = json_decode(\preg_replace('/(\${bf?)(\d+)([- \d]+\})/', '${1}' . $newFormId . '$3', $formAbandonment)); | |
| 49 | + } | |
| 50 | + | |
| 46 | 51 | if (isset($formSettings['mailTem'])) { |
| 47 | 52 | $mailTem = !is_string($formSettings['mailTem']) ? wp_json_encode($formSettings['mailTem']) : $formSettings['mailTem']; |
| 48 | 53 | $formSettings['mailTem'] = json_decode(\preg_replace('/(\${bf?)(\d+)([- \d]+\})/', '${1}' . $newFormId . '$3', $mailTem)); |
| 49 | 54 | $formData->formSettings = (object)$formSettings; |
| 50 | 55 | } |
| 56 | + | |
| 57 | + if (isset($formSettings['pdfTem'])) { | |
| 58 | + $pdfTem = !is_string($formSettings['pdfTem']) ? wp_json_encode($formSettings['pdfTem']) : $formSettings['pdfTem']; | |
| 59 | + $formSettings['pdfTem'] = json_decode(\preg_replace('/(\${bf?)(\d+)([- \d]+\})/', '${1}' . $newFormId . '$3', $pdfTem)); | |
| 60 | + $formData->formSettings = (object)$formSettings; | |
| 61 | + } | |
| 51 | 62 | } |
| 52 | 63 | |
| 53 | 64 | if (isset($data['breakpointSize'])) { |
| 54 | 65 | $formData->breakpointSize = $data['breakpointSize']; |
| @@ -87,8 +98,20 @@ | ||
| 87 | 98 | if (isset($data['additional'])) { |
| 88 | 99 | $formData->additional = $data['additional']; |
| 89 | 100 | } |
| 90 | 101 | |
| 102 | + $formData->customCode = (object) []; | |
| 103 | + if (isset($data['customCode']->customCss)) { | |
| 104 | + $customCss = !is_string($data['customCode']->customCss) ? wp_json_encode($data['customCode']->customCss) : $data['customCode']->customCss; | |
| 105 | + $customCss = \preg_replace('/(\${bf?)(\d+)([- \d]+\})/', '${1}' . $newFormId . '$3', $customCss); | |
| 106 | + $formData->customCode->customCss = \preg_replace('/(\"bf?)(\d+)([- \d]+\")/', '${1}' . $newFormId . '$3', $customCss); | |
| 107 | + } | |
| 108 | + | |
| 109 | + if (isset($data['customCode']->customJs)) { | |
| 110 | + $customJs = !is_string($data['customCode']->customJs) ? wp_json_encode($data['customCode']->customJs) : $data['customCode']->customJs; | |
| 111 | + $customJs = \preg_replace('/(\${bf?)(\d+)([- \d]+\})/', '${1}' . $newFormId . '$3', $customJs); | |
| 112 | + $formData->customCode->customJs = \preg_replace('/(\"bf?)(\d+)([- \d]+\")/', '${1}' . $newFormId . '$3', $customJs); | |
| 113 | + } | |
| 91 | 114 | return $formData; |
| 92 | 115 | } |
| 93 | 116 | |
| 94 | 117 | public static function genarateNewLayoutNField($layout, $fields, $oldId, $newId) |