Completed
Pull Request — master (#41)
by Jason
10:25
created

CustomerServiceBlock   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 5
dl 0
loc 51
ccs 15
cts 15
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A singular_name() 0 4 1
A plural_name() 0 4 1
A getCMSFields() 0 19 1
1
<?php
2
3
class CustomerServiceBlock extends Block
4
{
5
    /**
6
     * @return string
7
     */
8 10
    public function singular_name()
9
    {
10 10
        return _t('CustomerServiceBlock.SINGULARNAME', 'Customer Service Block');
11
    }
12
13
    /**
14
     * @return string
15
     */
16 1
    public function plural_name()
17
    {
18 1
        return _t('CustomerServiceBlock.PLURALNAME', 'Customer Service Blocks');
19
    }
20
21
    /**
22
     * @var array
23
     */
24
    private static $db = array(
25
        'Title' => 'Varchar(255)',
26
        'Website' => 'Varchar(255)',
27
        'Phone' => 'Varchar(40)',
28
        'Email' => 'Varchar(255)',
29
    );
30
31
    /**
32
     * @return FieldList
33
     */
34 1
    public function getCMSFields()
35
    {
36 1
        $fields = parent::getCMSFields();
37
38 1
        $fields->dataFieldByName('Title')
39 1
            ->setTitle('Name');
40
41 1
        $fields->replaceField('Country', CountryDropdownField::create('Country'));
42
43 1
        $fields->dataFieldByName('Website')
44 1
            ->setAttribute('placeholder', 'http://');
45
46 1
        $fields->replaceField('Email', EmailField::create('Email'));
47
48 1
        $fields->dataFieldByName('Suburb')
49 1
            ->setTitle('City');
50
51 1
        return $fields;
52
    }
53
}