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

ImageSlide::getCMSFields()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 7
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 12
rs 10
1
<?php
2
3
namespace Dynamic\FlexSlider\Model;
4
5
use Dynamic\FlexSlider\Interfaces\SlideInterface;
6
use Dynamic\ImageUpload\ImageUploadField;
0 ignored issues
show
Bug introduced by
The type Dynamic\ImageUpload\ImageUploadField was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

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