| 1 |
<?php |
| 2 |
|
| 3 |
namespace IvyForms\Services\Template; |
| 4 |
|
| 5 |
// phpcs:disable PSR1.Files.SideEffects |
| 6 |
if (!defined('ABSPATH')) { |
| 7 |
exit; // Exit if accessed directly |
| 8 |
} |
| 9 |
|
| 10 |
use IvyForms\Services\Translations\BackendStrings; |
| 11 |
|
| 12 |
class ContactFormTemplate |
| 13 |
{ |
| 14 |
/** |
| 15 |
* Get the contact form template |
| 16 |
* |
| 17 |
* @return array<string, mixed> |
| 18 |
*/ |
| 19 |
public static function getTemplate(): array |
| 20 |
{ |
| 21 |
return [ |
| 22 |
'id' => 'contact_form', |
| 23 |
'name' => BackendStrings::getTemplateStrings()['contact_form'], |
| 24 |
'description' => BackendStrings::getTemplateStrings()['contact_form_desc'], |
| 25 |
'category' => 'contact-forms', |
| 26 |
'is_pro' => false, |
| 27 |
'screenshot' => IVYFORMS_TEMPLATES_IMAGES_URL . 'contact-form.svg', |
| 28 |
'form_data' => [ |
| 29 |
'name' => BackendStrings::getTemplateStrings()['contact_form'], |
| 30 |
'published' => 1, |
| 31 |
'showTitle' => 1, |
| 32 |
'storeEntries' => 1, |
| 33 |
'integrationSettings' => TemplateDefaults::getDefaultIntegrationSettings(), |
| 34 |
'fields' => [ |
| 35 |
[ |
| 36 |
'id' => 'first_name', |
| 37 |
'fieldIndex' => 1, |
| 38 |
'type' => 'text', |
| 39 |
'label' => BackendStrings::getTemplateStrings()['first_name'], |
| 40 |
'placeholder' => BackendStrings::getTemplateStrings()['enter_your_first_name'], |
| 41 |
'required' => true, |
| 42 |
'validation' => [ |
| 43 |
'required' => true, |
| 44 |
], |
| 45 |
'settings' => [ |
| 46 |
'css_class' => 'ivyforms-field-first-name' |
| 47 |
] |
| 48 |
], |
| 49 |
[ |
| 50 |
'id' => 'last_name', |
| 51 |
'fieldIndex' => 2, |
| 52 |
'type' => 'text', |
| 53 |
'label' => BackendStrings::getTemplateStrings()['last_name'], |
| 54 |
'placeholder' => BackendStrings::getTemplateStrings()['enter_your_last_name'], |
| 55 |
'required' => true, |
| 56 |
'validation' => [ |
| 57 |
'required' => true, |
| 58 |
], |
| 59 |
'settings' => [ |
| 60 |
'css_class' => 'ivyforms-field-last-name' |
| 61 |
] |
| 62 |
], |
| 63 |
[ |
| 64 |
'id' => 'email', |
| 65 |
'fieldIndex' => 3, |
| 66 |
'type' => 'email', |
| 67 |
'label' => BackendStrings::getTemplateStrings()['email_address'], |
| 68 |
'placeholder' => BackendStrings::getTemplateStrings()['enter_your_email_address'], |
| 69 |
'required' => true, |
| 70 |
'validation' => [ |
| 71 |
'required' => true, |
| 72 |
'email' => true |
| 73 |
], |
| 74 |
'settings' => [ |
| 75 |
'css_class' => 'ivyforms-field-email' |
| 76 |
] |
| 77 |
], |
| 78 |
[ |
| 79 |
'id' => 'subject', |
| 80 |
'fieldIndex' => 4, |
| 81 |
'type' => 'text', |
| 82 |
'label' => BackendStrings::getTemplateStrings()['subject'], |
| 83 |
'placeholder' => BackendStrings::getTemplateStrings()['what_is_this_regarding'], |
| 84 |
'required' => false, |
| 85 |
'validation' => [ |
| 86 |
'required' => false, |
| 87 |
], |
| 88 |
'settings' => [ |
| 89 |
'css_class' => 'ivyforms-field-subject' |
| 90 |
] |
| 91 |
], |
| 92 |
[ |
| 93 |
'id' => 'message', |
| 94 |
'fieldIndex' => 5, |
| 95 |
'type' => 'textarea', |
| 96 |
'label' => BackendStrings::getTemplateStrings()['message'], |
| 97 |
'placeholder' => BackendStrings::getTemplateStrings()['please_enter_your_message_here'], |
| 98 |
'required' => false, |
| 99 |
'validation' => [ |
| 100 |
'required' => false, |
| 101 |
], |
| 102 |
'settings' => [ |
| 103 |
'css_class' => 'ivyforms-field-message' |
| 104 |
] |
| 105 |
] |
| 106 |
], |
| 107 |
'settings' => [] |
| 108 |
] |
| 109 |
]; |
| 110 |
} |
| 111 |
} |
| 112 |
|