← All changes
|
backend/src/Controllers/Template/GetTemplateController.php
+3
-5
0.8.2
→
1.5
View file →
| @@ -6,13 +6,8 @@ | ||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | namespace IvyForms\Controllers\Template; |
| 9 | 9 | |
| 10 | -// phpcs:disable PSR1.Files.SideEffects | |
| 11 | -if (!defined('ABSPATH')) { | |
| 12 | - exit; // Exit if accessed directly | |
| 13 | -} | |
| 14 | - | |
| 15 | 10 | use IvyForms\Common\Exceptions\ForbiddenException; |
| 16 | 11 | use IvyForms\Common\Exceptions\InvalidArgumentException; |
| 17 | 12 | use IvyForms\Common\Sanitizer\Sanitizer; |
| 18 | 13 | use IvyForms\Controllers\Controller; |
| @@ -62,8 +57,11 @@ | ||
| 62 | 57 | throw new InvalidArgumentException( |
| 63 | 58 | BackendStrings::getTemplateStrings()['template_not_found'] |
| 64 | 59 | ); |
| 65 | 60 | } |
| 61 | + | |
| 62 | + // Apply the same field layout rules used on form create (one field per row by default). | |
| 63 | + $template['form_data'] = $this->templateService->getFormDataFromTemplate($templateId); | |
| 66 | 64 | |
| 67 | 65 | return new WP_REST_Response([ |
| 68 | 66 | 'success' => true, |
| 69 | 67 | 'data' => $template |