Completed
Pull Request — master (#54)
by Nic
11:20
created

EmbedCodeBlock   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 3
dl 0
loc 47
ccs 12
cts 12
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 12 1
1
<?php
2
3
/**
4
 * Class EmbedCodeBlock
5
 */
6
class EmbedCodeBlock extends Block
7
{
8
9
    /**
10
     * @return string
11
     */
12 13
    public function singular_name()
13
    {
14 13
        return _t('EmbedCodeBlock.SINGULARNAME', 'Embed Code Block');
15
    }
16
17
    /**
18
     * @return string
19
     */
20 1
    public function plural_name()
21
    {
22 1
        return _t('EmbedCodeBlock.PLURALNAME', 'Embed Code Blocks');
23
    }
24
    /**
25
     * @var string
26
     */
27
    private static $description = 'Block providing ability to embed code (generally javascript)';
28
29
    /**
30
     * @var array
31
     */
32
    private static $db = [
33
        'Code' => 'HTMLText',
34
    ];
35
36
    /**
37
     * @return \FieldList
38
     */
39 1
    public function getCMSFields()
40
    {
41 1
        $fields = parent::getCMSFields();
42
43 1
        $fields->replaceField(
44 1
            'Code',
45 1
            TextareaField::create('Code')
46 1
                ->setTitle('Embed Code')
47 1
        );
48
49 1
        return $fields;
50
    }
51
52
}