Total Complexity | 1 |
Total Lines | 29 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
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(), |
||
|
|||
31 | $width = $this->Parent()->DataPointImage()->getWidth(), |
||
32 | $height = $this->Parent()->DataPointImage()->getHeight(), |
||
33 | $cssGrid = true |
||
34 | ) |
||
39 |