Completed
Push — master ( dbc3d2...195028 )
by Jason
13:58
created

CustomerServiceBlock::getCMSFields()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 19
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 19
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 11
nc 1
nop 0
1
<?php
2
3
class CustomerServiceBlock extends Block
4
{
5
    /**
6
     * @return string
7
     */
8
    public function singular_name()
9
    {
10
        return _t('CustomerServiceBlock.SINGULARNAME', 'Customer Service Block');
11
    }
12
13
    /**
14
     * @return string
15
     */
16
    public function plural_name()
17
    {
18
        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
    public function getCMSFields()
35
    {
36
        $fields = parent::getCMSFields();
37
38
        $fields->dataFieldByName('Title')
39
            ->setTitle('Name');
40
41
        $fields->replaceField('Country', CountryDropdownField::create('Country'));
42
43
        $fields->dataFieldByName('Website')
44
            ->setAttribute('placeholder', 'http://');
45
46
        $fields->replaceField('Email', EmailField::create('Email'));
47
48
        $fields->dataFieldByName('Suburb')
49
            ->setTitle('City');
50
51
        return $fields;
52
    }
53
}