← All changes
|
backend/src/Services/Template/CookingClassRegistrationFormTemplate.php
+20
-11
0.9
→
1.5
View file →
| @@ -3,26 +3,21 @@ | ||
| 3 | 3 | declare(strict_types=1); |
| 4 | 4 | |
| 5 | 5 | namespace IvyForms\Services\Template; |
| 6 | 6 | |
| 7 | -// phpcs:disable PSR1.Files.SideEffects | |
| 8 | -if (!defined('ABSPATH')) { | |
| 9 | - exit; // Exit if accessed directly | |
| 10 | -} | |
| 11 | - | |
| 12 | 7 | use IvyForms\Services\Translations\BackendStrings; |
| 13 | 8 | |
| 9 | +class CookingClassRegistrationFormTemplate | |
| 10 | +{ | |
| 14 | 11 | /** |
| 15 | 12 | * Cooking Class Registration Form Template |
| 16 | 13 | */ |
| 17 | -class CookingClassRegistrationFormTemplate | |
| 18 | -{ | |
| 19 | 14 | /** |
| 20 | - * Get the template configuration | |
| 15 | + * Get template metadata (without form_data) | |
| 21 | 16 | * |
| 22 | 17 | * @return array<string, mixed> |
| 23 | 18 | */ |
| 24 | - public static function getTemplate(): array | |
| 19 | + public static function getTemplateMeta(): array | |
| 25 | 20 | { |
| 26 | 21 | return [ |
| 27 | 22 | 'id' => 'cooking_class_registration_form', |
| 28 | 23 | 'name' => BackendStrings::getTemplateStrings()['cooking_class_registration_form'], |
| @@ -31,9 +26,22 @@ | ||
| 31 | 26 | ], |
| 32 | 27 | 'category' => 'registration-forms', |
| 33 | 28 | 'subcategory' => 'class-registration-forms', |
| 34 | 29 | 'is_pro' => false, |
| 35 | - 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'cooking-class-registration-form.svg', | |
| 30 | + 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'cooking-class-registration-form.svg' | |
| 31 | + ]; | |
| 32 | + } | |
| 33 | + | |
| 34 | + /** | |
| 35 | + * Get the full template including form data | |
| 36 | + * | |
| 37 | + * @return array<string, mixed> | |
| 38 | + */ | |
| 39 | + public static function getTemplate(): array | |
| 40 | + { | |
| 41 | + return array_merge( | |
| 42 | + self::getTemplateMeta(), | |
| 43 | + [ | |
| 36 | 44 | 'form_data' => [ |
| 37 | 45 | 'name' => BackendStrings::getTemplateStrings()['cooking_class_registration_form'], |
| 38 | 46 | 'published' => 1, |
| 39 | 47 | 'showTitle' => 1, |
| @@ -46,9 +54,10 @@ | ||
| 46 | 54 | self::getAdditionalInformationFields() |
| 47 | 55 | ), |
| 48 | 56 | 'settings' => [] |
| 49 | 57 | ] |
| 50 | - ]; | |
| 58 | + ] | |
| 59 | + ); | |
| 51 | 60 | } |
| 52 | 61 | |
| 53 | 62 | /** |
| 54 | 63 | * Personal information fields (name, email, phone) |