← All changes
|
backend/src/Services/Template/CustomCakeOrderFormTemplate.php
+18
-9
0.9
→
1.5.1
View file →
| @@ -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 CustomCakeOrderFormTemplate |
| 13 | 8 | { |
| 14 | 9 | /** |
| 15 | - * Get the custom cake order 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' => 'custom_cake_order_form', |
| 23 | 18 | 'name' => BackendStrings::getTemplateStrings()['custom_cake_order_form'], |
| @@ -24,9 +19,22 @@ | ||
| 24 | 19 | 'description' => BackendStrings::getTemplateStrings()['custom_cake_order_form_desc'], |
| 25 | 20 | 'category' => 'order-forms', |
| 26 | 21 | 'subcategory' => 'cake-order-forms', |
| 27 | 22 | 'is_pro' => false, |
| 28 | - 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'custom-cake-order-form.svg', | |
| 23 | + 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'custom-cake-order-form.svg' | |
| 24 | + ]; | |
| 25 | + } | |
| 26 | + | |
| 27 | + /** | |
| 28 | + * Get the full template including form data | |
| 29 | + * | |
| 30 | + * @return array<string, mixed> | |
| 31 | + */ | |
| 32 | + public static function getTemplate(): array | |
| 33 | + { | |
| 34 | + return array_merge( | |
| 35 | + self::getTemplateMeta(), | |
| 36 | + [ | |
| 29 | 37 | 'form_data' => [ |
| 30 | 38 | 'name' => BackendStrings::getTemplateStrings()['custom_cake_order_form'], |
| 31 | 39 | 'published' => 1, |
| 32 | 40 | 'showTitle' => 1, |
| @@ -38,9 +46,10 @@ | ||
| 38 | 46 | self::getDeliveryDetailsFields() |
| 39 | 47 | ), |
| 40 | 48 | 'settings' => [] |
| 41 | 49 | ] |
| 42 | - ]; | |
| 50 | + ] | |
| 51 | + ); | |
| 43 | 52 | } |
| 44 | 53 | |
| 45 | 54 | /** |
| 46 | 55 | * Get customer information fields |