SiteConfigExtension   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 12
dl 0
loc 20
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A updateCMSFields() 0 14 1
1
<?php
2
3
namespace Sunnysideup\GetSiteControl\Extensions;
4
5
use SilverStripe\Forms\FieldList;
6
use SilverStripe\Forms\LiteralField;
7
use SilverStripe\Forms\TextField;
8
use SilverStripe\ORM\DataExtension;
9
10
class SiteConfigExtension extends DataExtension
11
{
12
    private static $db = [
13
        'GetSiteControlAPI' => 'Varchar(30)',
14
    ];
15
16
    public function updateCMSFields(FieldList $fields)
17
    {
18
        $fields->addFieldsToTab(
19
            'Root.GetSiteControl',
20
            [
21
                TextField::create(
22
                    'GetSiteControlAPI',
23
                    'GetSiteControl API Key'
24
                )
25
                    ->setDescription('Add just the key at the end of the link //l.getsitecontrol.com/3w0pvyd7.js, API Key is 3w0pvyd7'),
26
27
                LiteralField::create(
28
                    'GetSiteControlAPIHelp',
29
                    'Go to: <a target="_blank" href="https://dash.getsitecontrol.com/">GetSiteControl Dashboard</a>'
30
                ),
31
            ]
32
        );
33
    }
34
}
35