| @@ -6,13 +6,8 @@ | ||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | namespace IvyForms\Services\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\InvalidArgumentException; |
| 16 | 11 | use IvyForms\Services\Translations\BackendStrings; |
| 17 | 12 | |
| 18 | 13 | /** |
| @@ -22,21 +17,21 @@ | ||
| 22 | 17 | */ |
| 23 | 18 | class TemplateService |
| 24 | 19 | { |
| 25 | 20 | /** |
| 26 | - * Get all predefined form templates | |
| 21 | + * Get all template metadata (without form_data) for listing | |
| 27 | 22 | * |
| 28 | 23 | * @return array<string, array<string, mixed>> |
| 29 | 24 | */ |
| 30 | - public function getAllTemplates(): array | |
| 25 | + public function getAllTemplateMetas(): array | |
| 31 | 26 | { |
| 32 | - return TemplateMapper::getAllTemplates(); | |
| 27 | + return TemplateMapper::getAllTemplateMetas(); | |
| 33 | 28 | } |
| 34 | 29 | |
| 35 | 30 | /** |
| 36 | 31 | * Get predefined form template by ID |
| 37 | 32 | * |
| 38 | - * @param string $templateId | |
| 33 | + * @param string $templateId | |
| 39 | 34 | * @return array<string, mixed>|null |
| 40 | 35 | */ |
| 41 | 36 | public function getTemplateById(string $templateId): ?array |
| 42 | 37 | { |
| @@ -45,9 +40,9 @@ | ||
| 45 | 40 | |
| 46 | 41 | /** |
| 47 | 42 | * Get form data from template by ID |
| 48 | 43 | * |
| 49 | - * @param string $templateId | |
| 44 | + * @param string $templateId | |
| 50 | 45 | * @return array<string, mixed> |
| 51 | 46 | * @throws InvalidArgumentException |
| 52 | 47 | */ |
| 53 | 48 | public function getFormDataFromTemplate(string $templateId): array |
| @@ -74,9 +69,9 @@ | ||
| 74 | 69 | |
| 75 | 70 | /** |
| 76 | 71 | * Assign layout properties to fields |
| 77 | 72 | * |
| 78 | - * @param array<int, array<string, mixed>> $fields | |
| 73 | + * @param array<int, array<string, mixed>> $fields | |
| 79 | 74 | * @return array<int, array<string, mixed>> |
| 80 | 75 | */ |
| 81 | 76 | private function assignFieldLayout(array $fields): array |
| 82 | 77 | { |
| @@ -100,9 +95,9 @@ | ||
| 100 | 95 | |
| 101 | 96 | /** |
| 102 | 97 | * Check if field should get default layout |
| 103 | 98 | * |
| 104 | - * @param array<string, mixed> $field | |
| 99 | + * @param array<string, mixed> $field | |
| 105 | 100 | * @return bool |
| 106 | 101 | */ |
| 107 | 102 | private function shouldAssignLayout(array $field): bool |
| 108 | 103 | { |
| @@ -114,9 +109,9 @@ | ||
| 114 | 109 | |
| 115 | 110 | /** |
| 116 | 111 | * Check if field has custom layout |
| 117 | 112 | * |
| 118 | - * @param array<string, mixed> $field | |
| 113 | + * @param array<string, mixed> $field | |
| 119 | 114 | * @return bool |
| 120 | 115 | */ |
| 121 | 116 | private function hasCustomLayout(array $field): bool |
| 122 | 117 | { |
| @@ -130,11 +125,11 @@ | ||
| 130 | 125 | */ |
| 131 | 126 | public function getTemplateCategories(): array |
| 132 | 127 | { |
| 133 | 128 | return [ |
| 134 | -// 'basic' => [ | |
| 135 | -// 'name' => '', | |
| 136 | -// 'description' => '' | |
| 137 | -// ] | |
| 129 | + // 'basic' => [ | |
| 130 | + // 'name' => '', | |
| 131 | + // 'description' => '' | |
| 132 | + // ] | |
| 138 | 133 | ]; |
| 139 | 134 | } |
| 140 | 135 | } |