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

CustomerServiceBlock::getCMSFields()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 19
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 11
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 19
ccs 11
cts 11
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 11
nc 1
nop 0
crap 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
}