| @@ -1,23 +1,18 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | namespace IvyForms\Services\Template; |
| 4 | 4 | |
| 5 | -// phpcs:disable PSR1.Files.SideEffects | |
| 6 | -if (!defined('ABSPATH')) { | |
| 7 | - exit; // Exit if accessed directly | |
| 8 | -} | |
| 9 | - | |
| 10 | 5 | use IvyForms\Services\Translations\BackendStrings; |
| 11 | 6 | |
| 12 | 7 | class BlankFormTemplate |
| 13 | 8 | { |
| 14 | 9 | /** |
| 15 | - * Get the blank form template | |
| 10 | + * Get template metadata (without form_data) | |
| 16 | 11 | * |
| 17 | 12 | * @return array<string, mixed> |
| 18 | 13 | */ |
| 19 | - public static function getTemplate(): array | |
| 14 | + public static function getTemplateMeta(): array | |
| 20 | 15 | { |
| 21 | 16 | return [ |
| 22 | 17 | 'id' => 'blank_form', |
| 23 | 18 | 'name' => BackendStrings::getSettingsFormBuilderStrings()['blank_form'], |
| @@ -23,9 +18,22 @@ | ||
| 23 | 18 | 'name' => BackendStrings::getSettingsFormBuilderStrings()['blank_form'], |
| 24 | 19 | 'description' => '', |
| 25 | 20 | 'category' => 'basic', |
| 26 | 21 | 'is_pro' => false, |
| 27 | - 'screenshot' => '', | |
| 22 | + 'screenshot' => '' | |
| 23 | + ]; | |
| 24 | + } | |
| 25 | + | |
| 26 | + /** | |
| 27 | + * Get the full template including form data | |
| 28 | + * | |
| 29 | + * @return array<string, mixed> | |
| 30 | + */ | |
| 31 | + public static function getTemplate(): array | |
| 32 | + { | |
| 33 | + return array_merge( | |
| 34 | + self::getTemplateMeta(), | |
| 35 | + [ | |
| 28 | 36 | 'form_data' => [ |
| 29 | 37 | 'name' => BackendStrings::getSettingsFormBuilderStrings()['blank_form'], |
| 30 | 38 | 'description' => '', |
| 31 | 39 | 'published' => 1, |
| @@ -34,7 +42,8 @@ | ||
| 34 | 42 | 'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(), |
| 35 | 43 | 'fields' => [], |
| 36 | 44 | 'settings' => [] |
| 37 | 45 | ] |
| 38 | - ]; | |
| 46 | + ] | |
| 47 | + ); | |
| 39 | 48 | } |
| 40 | 49 | } |