ImageBlock::getCMSFields()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 9
Ratio 100 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 9
loc 9
ccs 5
cts 5
cp 1
rs 9.6666
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 0
crap 1
1
<?php
2
3 View Code Duplication
class ImageBlock 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...
4
{
5
    /**
6
     * @return string
7
     */
8 12
    public function singular_name()
9
    {
10 12
        return _t('ImageBlock.SINGULARNAME', 'Image Block');
11
    }
12
13
    /**
14
     * @return string
15
     */
16 1
    public function plural_name()
17
    {
18 1
        return _t('ImageBlock.PLURALNAME', 'Image Blocks');
19
    }
20
21
    /**
22
     * @var array
23
     */
24
    private static $has_one = array(
25
        'Image' => 'Image',
26
    );
27
28
    /**
29
     * @return FieldList
30
     */
31 1
    public function getCMSFields()
32
    {
33 1
        $fields = parent::getCMSFields();
34
35 1
        $fields->dataFieldByName('Title')->setDescription('Internal reference only');
36 1
        $fields->dataFieldByName('Image')->setFolderName('Uploads/ImageBlocks');
37
38 1
        return $fields;
39
    }
40
}