← All changes
|
backend/src/Services/Template/ServiceSpecificClientFeedbackFormTemplate.php
+17
-8
0.9.1
→
1.5
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 ServiceSpecificClientFeedbackFormTemplate |
| 13 | 8 | { |
| 14 | 9 | /** |
| 15 | - * Get the Service-Specific Client Feedback 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' => 'service_specific_client_feedback_form', |
| 23 | 18 | 'name' => BackendStrings::getTemplateStrings()['service_specific_client_feedback_form'], |
| @@ -25,8 +20,21 @@ | ||
| 25 | 20 | 'category' => 'feedback-forms', |
| 26 | 21 | 'subcategory' => 'client-feedback-forms', |
| 27 | 22 | 'is_pro' => false, |
| 28 | 23 | 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'service-specific-client-feedback-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()['service_specific_client_feedback_form'], |
| 31 | 39 | 'published' => 1, |
| 32 | 40 | 'showTitle' => 1, |
| @@ -41,9 +49,10 @@ | ||
| 41 | 49 | self::getAdditionalCommentsParagraphField() |
| 42 | 50 | ), |
| 43 | 51 | 'settings' => [] |
| 44 | 52 | ] |
| 45 | - ]; | |
| 53 | + ] | |
| 54 | + ); | |
| 46 | 55 | } |
| 47 | 56 | |
| 48 | 57 | /** |
| 49 | 58 | * Service received dropdown field |