Completed
Push — master ( 7a9fbe...a52dd2 )
by Matthew
05:41
created

LocatorExtension::updateCMSFields()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 12
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 11
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 13
ccs 12
cts 12
cp 1
crap 1
rs 9.4285
1
<?php
2
3
namespace Dynamic\Locator\React\Extensions;
4
5
use SilverStripe\Forms\CheckboxField;
6
use SilverStripe\Forms\FieldList;
7
use SilverStripe\Forms\NumericField;
8
use SilverStripe\ORM\DataExtension;
9
10
/**
11
 * Class LocatorExtension
12
 * @package Dynamic\Locator\React\Extensions
13
 */
14
class LocatorExtension extends DataExtension
15
{
16
17
    private static $db = [
0 ignored issues
show
introduced by
The private property $db is not used, and could be removed.
Loading history...
18
        'DefaultLat' => 'Decimal(10,7)',
19
        'DefaultLng' => 'Decimal(10,7)',
20
        'Clusters' => 'Boolean',
21
        'Autocomplete' => 'Boolean',
22
    ];
23
24 1
    public function updateCMSFields(FieldList $fields)
25
    {
26 1
        $fields->addFieldsToTab('Root.Settings', [
27 1
            NumericField::create('DefaultLat')
0 ignored issues
show
Bug introduced by
'DefaultLat' of type string is incompatible with the type array expected by parameter $args of SilverStripe\View\ViewableData::create(). ( Ignorable by Annotation )

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

27
            NumericField::create(/** @scrutinizer ignore-type */ 'DefaultLat')
Loading history...
28 1
                ->setTitle('Default Latitude')
29 1
                ->setScale(7),
30 1
            NumericField::create('DefaultLng')
31 1
                ->setTitle('Default Longitude')
32 1
                ->setScale(7),
33 1
            CheckboxField::create('Clusters')
34 1
                ->setRightTitle('Cluster the markers when zoomed out.'),
35 1
            CheckboxField::create('Autocomplete')
36 1
                ->setRightTitle('Address field will suggest locations')
37
        ]);
38
    }
39
}
40