| @@ -67,17 +67,15 @@ | ||
| 67 | 67 | $form = $this->formService->getFormById($formId); |
| 68 | 68 | $fieldsMap = $this->fieldService->getAllFieldsWithOptions($form->getId()); |
| 69 | 69 | $form->setFields($fieldsMap); |
| 70 | 70 | |
| 71 | - $confirmationsArr = $this->confirmationService->getConfirmationsById($formId); | |
| 71 | + $defaultConfirmationId = $this->confirmationService->ensureDefaultConfirmationExists($formId); | |
| 72 | 72 | |
| 73 | - $confirmations = []; | |
| 74 | - foreach ($confirmationsArr as $confirmation) { | |
| 75 | - $confirmations[] = $confirmation->toArray(); | |
| 76 | - } | |
| 77 | - | |
| 78 | 73 | return new WP_REST_Response([ |
| 79 | 74 | 'message' => BackendStrings::getCommonStrings()['ok'], |
| 80 | - 'data' => array_merge($form->toArray(), ['confirmationId' => $confirmations[0]['id']]) | |
| 75 | + 'data' => array_merge($form->toArray(), [ | |
| 76 | + 'confirmationId' => $defaultConfirmationId, | |
| 77 | + 'submissionNonce' => wp_create_nonce('ivyformsFrontSubmissionNonce_' . $formId), | |
| 78 | + ]), | |
| 81 | 79 | ], 200); |
| 82 | 80 | } |
| 83 | 81 | } |