← All changes
|
backend/src/Services/Template/EquipmentPurchaseOrderFormTemplate.php
+20
-11
0.9
→
1.5
View file →
| @@ -1,26 +1,21 @@ | ||
| 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 | |
| 7 | +class EquipmentPurchaseOrderFormTemplate | |
| 8 | +{ | |
| 12 | 9 | /** |
| 13 | 10 | * Equipment Purchase Order Form Template |
| 14 | 11 | */ |
| 15 | -class EquipmentPurchaseOrderFormTemplate | |
| 16 | -{ | |
| 17 | 12 | /** |
| 18 | - * Get the template configuration | |
| 13 | + * Get template metadata (without form_data) | |
| 19 | 14 | * |
| 20 | 15 | * @return array<string, mixed> |
| 21 | 16 | */ |
| 22 | - public static function getTemplate(): array | |
| 17 | + public static function getTemplateMeta(): array | |
| 23 | 18 | { |
| 24 | 19 | return [ |
| 25 | 20 | 'id' => 'equipment_purchase_order_form', |
| 26 | 21 | 'name' => BackendStrings::getTemplateStrings()['equipment_purchase_order_form'], |
| @@ -29,9 +24,22 @@ | ||
| 29 | 24 | ], |
| 30 | 25 | 'category' => 'order-forms', |
| 31 | 26 | 'subcategory' => 'product-order-forms', |
| 32 | 27 | 'is_pro' => false, |
| 33 | - 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'equipment-purchase-order-form.svg', | |
| 28 | + 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'equipment-purchase-order-form.svg' | |
| 29 | + ]; | |
| 30 | + } | |
| 31 | + | |
| 32 | + /** | |
| 33 | + * Get the full template including form data | |
| 34 | + * | |
| 35 | + * @return array<string, mixed> | |
| 36 | + */ | |
| 37 | + public static function getTemplate(): array | |
| 38 | + { | |
| 39 | + return array_merge( | |
| 40 | + self::getTemplateMeta(), | |
| 41 | + [ | |
| 34 | 42 | 'form_data' => [ |
| 35 | 43 | 'name' => BackendStrings::getTemplateStrings()['equipment_purchase_order_form'], |
| 36 | 44 | 'published' => 1, |
| 37 | 45 | 'showTitle' => 1, |
| @@ -43,9 +51,10 @@ | ||
| 43 | 51 | self::getAdditionalInformationFields() |
| 44 | 52 | ), |
| 45 | 53 | 'settings' => [] |
| 46 | 54 | ] |
| 47 | - ]; | |
| 55 | + ] | |
| 56 | + ); | |
| 48 | 57 | } |
| 49 | 58 | |
| 50 | 59 | /** |
| 51 | 60 | * Requestor information fields (name, email, phone, department) |