Passed
Pull Request — master (#2)
by Guy
08:17
created

DataPoint   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A getCMSFields() 0 16 1
1
<?php
2
3
namespace Sunnysideup\ImageClickSpots\Model;
4
5
use JonoM\ImageCoord\ImageCoordField;
6
use SilverStripe\ORM\DataObject;
7
8
class DataPoint extends DataObject
9
{
10
    private static $table_name = 'Sunnysideup_clickspots_DataPoint';
11
12
    private static $db = [
13
       'Title' => 'Varchar',
14
       'Description' => 'HTMLText',
15
    ];
16
17
    private static $has_one = [
18
        'Parent' => DataObject::class,
19
    ];
20
21
    public function getCMSFields()
22
    {
23
       $fields = parent::getCMSFields();
24
       $fields->addFieldToTab(
25
           'Root.Main',
26
           ImageCoordField::create(
27
               $name = 'DataPointImageCoordinates',
28
               $xFieldName = 'XCoordinate',
29
               $yFieldName = 'YCoordinate',
30
               $imageURL = $this->Parent()->DataPointImage()->Link(),
0 ignored issues
show
Bug introduced by
The method Parent() does not exist on Sunnysideup\ImageClickSpots\Model\DataPoint. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

30
               $imageURL = $this->/** @scrutinizer ignore-call */ Parent()->DataPointImage()->Link(),
Loading history...
31
               $width = $this->Parent()->DataPointImage()->getWidth(),
32
               $height = $this->Parent()->DataPointImage()->getHeight(),
33
               $cssGrid = true
34
           )
35
       );
36
       return $fields;
37
    }
38
}
39