Passed
Pull Request — master (#198)
by Nic
02:19
created

VideoSlide   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 17
c 1
b 0
f 0
dl 0
loc 48
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A getCMSFields() 0 14 1
1
<?php
2
3
namespace Dynamic\FlexSlider\Model;
4
5
use SilverStripe\AssetAdmin\Forms\UploadField;
6
use SilverStripe\Assets\File;
7
use SilverStripe\Forms\FieldList;
8
9
/**
10
 * Class VideoSlide
11
 * @package Dynamic\FlexSlider\Model
12
 */
13
class VideoSlide extends Slide
14
{
15
    /**
16
     * @var string
17
     */
18
    private static $singular_name = 'Video Slide';
0 ignored issues
show
introduced by
The private property $singular_name is not used, and could be removed.
Loading history...
19
20
    /**
21
     * @var string
22
     */
23
    private static $plural_name = 'Video Slides';
0 ignored issues
show
introduced by
The private property $plural_name is not used, and could be removed.
Loading history...
24
25
    /**
26
     * @var string
27
     */
28
    private static $table_name = 'VideoSlide';
0 ignored issues
show
introduced by
The private property $table_name is not used, and could be removed.
Loading history...
29
30
    /**
31
     * @var array
32
     */
33
    private static $has_one = [
0 ignored issues
show
introduced by
The private property $has_one is not used, and could be removed.
Loading history...
34
        'Video' => File::class,
35
    ];
36
37
    /**
38
     * @var array
39
     */
40
    private static $owns = [
0 ignored issues
show
introduced by
The private property $owns is not used, and could be removed.
Loading history...
41
        'Video',
42
    ];
43
44
    /**
45
     * @return FieldList
46
     */
47
    public function getCMSFields()
48
    {
49
        $this->beforeUpdateCMSFields(function (FieldList $fields) {
50
            $fields->addFieldToTab(
51
                'Root.Main',
52
                UploadField::create('Video')
53
                    ->setTitle('Video')
54
                    ->setDescription('mp4 format')
55
                    ->setAllowedExtensions(['mp4']),
56
                'Content'
57
            );
58
        });
59
60
        return parent::getCMSFields();
61
    }
62
}
63