1
|
|
|
<?php
|
2
|
|
|
|
3
|
|
|
class ContactUsSiteConfigExtension extends DataExtension
|
|
|
|
|
4
|
|
|
{
|
5
|
|
|
|
6
|
|
|
private static $db = [
|
|
|
|
|
7
|
|
|
'ContactUsFormEmail' => 'Varchar(100)',
|
8
|
|
|
'ContactUsFormEnquiryLabel' => 'Varchar(50)',
|
9
|
|
|
'ContactUsFormSendLabel' => 'Varchar(50)',
|
10
|
|
|
'ContactUsFormThankYouMessage' => 'HTMLText'
|
11
|
|
|
];
|
12
|
|
|
|
13
|
|
|
private static $defaults = [
|
|
|
|
|
14
|
|
|
'ContactUsFormEnquiryLabel' => 'Message',
|
15
|
|
|
'ContactUsFormSendLabel' => 'Send',
|
16
|
|
|
'ContactUsFormThankYouMessage' => '<p class="message good">Thank you for your enquiry.</p>'
|
17
|
|
|
];
|
18
|
|
|
|
19
|
|
|
private static $field_labels = [
|
|
|
|
|
20
|
|
|
'ContactUsFormEmail' => 'Email to use',
|
21
|
|
|
'ContactUsFormEnquiryLabel' => 'Label for Message Box',
|
22
|
|
|
'ContactUsFormSendLabel' => 'Send Button Label',
|
23
|
|
|
'ContactUsFormThankYouMessage' => 'Message to show as thank you.'
|
24
|
|
|
];
|
25
|
|
|
|
26
|
|
|
/**
|
27
|
|
|
* Update Fields
|
28
|
|
|
* @return FieldList
|
29
|
|
|
*/
|
30
|
|
|
public function updateCMSFields(FieldList $fields)
|
31
|
|
|
{
|
32
|
|
|
$formLabels = $this->owner->FieldLabels();
|
33
|
|
|
$fields->addFieldsToTab(
|
34
|
|
|
'Root.ContactUs',
|
35
|
|
|
array(
|
36
|
|
|
TextField::create('ContactUsFormEmail', $formLabels['ContactUsFormEmail']),
|
37
|
|
|
TextField::create('ContactUsFormEnquiryLabel', $formLabels['ContactUsFormEnquiryLabel']),
|
38
|
|
|
TextField::create('ContactUsFormSendLabel', $formLabels['ContactUsFormSendLabel']),
|
39
|
|
|
HTMLEditorField::create('ContactUsFormThankYouMessage', $formLabels['ContactUsFormThankYouMessage'])
|
40
|
|
|
)
|
41
|
|
|
);
|
42
|
|
|
|
43
|
|
|
return $fields;
|
44
|
|
|
}
|
45
|
|
|
|
46
|
|
|
|
47
|
|
|
|
48
|
|
|
}
|
49
|
|
|
|
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.