Completed
Push — master ( 6cc61d...c92421 )
by Matthew
03:08
created

ElementSlideshow::getType()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
ccs 2
cts 2
cp 1
cc 1
eloc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Dynamic\Elements\Flexslider\Elements;
4
5
use DNADesign\Elemental\Models\BaseElement;
6
use SilverStripe\Forms\FieldList;
7
use SilverStripe\ORM\FieldType\DBField;
8
9
/**
10
 * Class ElementSlideshow
11
 * @package Dynamic\Elements\Flexslider\Elements
12
 *
13
 * @property string Content
14
 */
15
class ElementSlideshow extends BaseElement
16
{
17
    /**
18
     * @var string
19
     */
20
    private static $icon = 'slideshow-icon';
0 ignored issues
show
introduced by
The private property $icon is not used, and could be removed.
Loading history...
21
22
    /**
23
     * @var string
24
     */
25
    private static $singular_name = 'Flexslider Element';
0 ignored issues
show
introduced by
The private property $singular_name is not used, and could be removed.
Loading history...
26
27
    /**
28
     * @var string
29
     */
30
    private static $plural_name = 'Flexslider Elements';
0 ignored issues
show
introduced by
The private property $plural_name is not used, and could be removed.
Loading history...
31
32
    /**
33
     * @var string
34
     */
35
    private static $table_name = 'ElementSlideshow';
0 ignored issues
show
introduced by
The private property $table_name is not used, and could be removed.
Loading history...
36
37
    /**
38
     * @var array
39
     */
40
    private static $db = [
0 ignored issues
show
introduced by
The private property $db is not used, and could be removed.
Loading history...
41
        'Content' => 'HTMLText',
42
    ];
43
44
    public function getCMSFields()
45
    {
46 1
        $this->beforeUpdateCMSFields(function (FieldList $fields) {
47 1
            $fields->dataFieldByName('Content')
48 1
                ->setRows(8);
49 1
        });
50
51 1
        return parent::getCMSFields();
52
    }
53
54
    /**
55
     * @return \SilverStripe\ORM\FieldType\DBHTMLText
56
     */
57 1
    public function ElementSummary()
58
    {
59 1
        return DBField::create_field('HTMLText', $this->Content)->Summary(20);
60
    }
61
62
    /**
63
     * @return string
64
     */
65 1
    public function getType()
66
    {
67 1
        return _t(__CLASS__.'.BlockType', 'Slideshow');
68
    }
69
}
70