Completed
Pull Request — master (#62)
by Jason
12:32
created

EmbedCodeBlock::plural_name()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
dl 4
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Dynamic\DynamicBlocks\Block;
4
5
use SheaDawson\Blocks\Model\Block;
6
use SilverStripe\Forms\TextareaField;
7
8
/**
9
 * Class EmbedCodeBlock
10
 */
11 View Code Duplication
class EmbedCodeBlock extends Block
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
12
{
13
14
    /**
15
     * @return string
16
     */
17
    public function singular_name()
18
    {
19
        return _t('EmbedCodeBlock.SINGULARNAME', 'Embed Code Block');
20
    }
21
22
    /**
23
     * @return string
24
     */
25
    public function plural_name()
26
    {
27
        return _t('EmbedCodeBlock.PLURALNAME', 'Embed Code Blocks');
28
    }
29
    /**
30
     * @var string
31
     */
32
    private static $description = 'Block providing ability to embed code (generally javascript)';
33
34
    /**
35
     * @var array
36
     */
37
    private static $db = [
38
        'Code' => 'HTMLText',
39
    ];
40
41
    /**
42
     * @return \FieldList
43
     */
44
    public function getCMSFields()
45
    {
46
        $fields = parent::getCMSFields();
47
48
        $fields->replaceField(
49
            'Code',
50
            TextareaField::create('Code')
51
                ->setTitle('Embed Code')
52
        );
53
54
        return $fields;
55
    }
56
57
}