PluginProbe
The Innovative Form Builder – IvyForms / 1.5
The Innovative Form Builder – IvyForms v1.5
1.5.1 1.5 1.4.1 1.4 trunk 0.1.2 0.2 0.2.1 0.3 0.3.1 0.4 0.5 0.6 0.6.1 0.6.1-backup 0.6.1.1 0.7 0.8 0.8.1 0.8.2 0.9 0.9.1 1.0 1.1 1.1.1 All 27 releases
← All changes | backend/src/Services/Template/ContactFormTemplate.php +26 -17 0.8.2 → 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 ContactFormTemplate
13 8 {
14 9 /**
15 - * Get the contact 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' => 'contact_form',
23 18 'name' => BackendStrings::getTemplateStrings()['contact_form'],
@@ -24,9 +19,22 @@
24 19 'description' => BackendStrings::getTemplateStrings()['contact_form_desc'],
25 20 'category' => 'contact-forms',
26 21 'subcategory' => 'emergency-contact-forms',
27 22 'is_pro' => false,
28 - 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'contact-form.svg',
23 + 'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'contact-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()['contact_form'],
31 39 'published' => 1,
32 40 'showTitle' => 1,
@@ -34,9 +42,9 @@
34 42 'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(),
35 43 'fields' => [
36 44 // Name Field - Parent
37 45 [
38 - 'id' => 0,
46 + 'id' => 1,
39 47 'fieldIndex' => 1,
40 48 'type' => 'name',
41 49 'label' => BackendStrings::getTemplateStrings()['full_name'],
42 50 'parentId' => null,
@@ -47,14 +55,14 @@
47 55 'position' => 1,
48 56 ],
49 57 // First Name - Child of Name Field
50 58 [
51 - 'id' => 0,
59 + 'id' => 2,
52 60 'type' => 'text',
53 61 'label' => BackendStrings::getTemplateStrings()['first_name'],
54 62 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_first_name'],
55 63 'required' => true,
56 - 'parentId' => 0,
64 + 'parentId' => 1,
57 65 'fieldIndex' => 1,
58 66 'defaultValue' => '',
59 67 'position' => 1,
60 68 'optionHide' => false,
@@ -62,14 +70,14 @@
62 70 'settings' => json_encode(['nameFieldType' => 'nameField1']),
63 71 ],
64 72 // Last Name - Child of Name Field
65 73 [
66 - 'id' => 0,
74 + 'id' => 3,
67 75 'type' => 'text',
68 76 'label' => BackendStrings::getTemplateStrings()['last_name'],
69 77 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_last_name'],
70 78 'required' => true,
71 - 'parentId' => 0,
79 + 'parentId' => 1,
72 80 'fieldIndex' => 1,
73 81 'defaultValue' => '',
74 82 'position' => 2,
75 83 'optionHide' => false,
@@ -76,9 +84,9 @@
76 84 'description' => '',
77 85 'settings' => json_encode(['nameFieldType' => 'nameField2']),
78 86 ],
79 87 [
80 - 'id' => 'email',
88 + 'id' => 4,
81 89 'fieldIndex' => 2,
82 90 'type' => 'email',
83 91 'label' => BackendStrings::getTemplateStrings()['email_address'],
84 92 'placeholder' => BackendStrings::getTemplateStrings()['enter_your_email_address'],
@@ -92,9 +100,9 @@
92 100 ],
93 101 'position' => 2,
94 102 ],
95 103 [
96 - 'id' => 'subject',
104 + 'id' => 5,
97 105 'fieldIndex' => 3,
98 106 'type' => 'text',
99 107 'label' => BackendStrings::getTemplateStrings()['subject'],
100 108 'placeholder' => BackendStrings::getTemplateStrings()['what_is_this_regarding'],
@@ -107,9 +115,9 @@
107 115 ],
108 116 'position' => 3,
109 117 ],
110 118 [
111 - 'id' => 'message',
119 + 'id' => 6,
112 120 'fieldIndex' => 4,
113 121 'type' => 'textarea',
114 122 'label' => BackendStrings::getTemplateStrings()['message'],
115 123 'placeholder' => BackendStrings::getTemplateStrings()['please_enter_your_message_here'],
@@ -124,7 +132,8 @@
124 132 ]
125 133 ],
126 134 'settings' => []
127 135 ]
128 - ];
136 + ]
137 + );
129 138 }
130 139 }