ContactUsSiteConfigExtension   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 4
dl 0
loc 46
c 0
b 0
f 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A updateCMSFields() 0 15 1
1
<?php
2
3
class ContactUsSiteConfigExtension extends DataExtension
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
4
{
5
6
    private static $db = [
0 ignored issues
show
Unused Code introduced by
The property $db is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
7
        'ContactUsFormEmail' => 'Varchar(100)',
8
        'ContactUsFormEnquiryLabel' => 'Varchar(50)',
9
        'ContactUsFormSendLabel' => 'Varchar(50)',
10
        'ContactUsFormThankYouMessage' => 'HTMLText'
11
    ];
12
13
    private static $defaults = [
0 ignored issues
show
Unused Code introduced by
The property $defaults is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
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 = [
0 ignored issues
show
Unused Code introduced by
The property $field_labels is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
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