DataExtension::updateCMSFields()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 19
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 19
rs 9.4285
cc 1
eloc 7
nc 1
nop 1
1
<?php
2
3
/**
4
 * Adds Facebook Domain Insights settings to SiteConfig.
5
 *
6
 * @package silverstripe-seo
7
 * @subpackage facebook-domain-insights
8
 * @author Andrew Gerber <[email protected]>
9
 * @version 1.0.0
10
 *
11
 */
12
class SEO_FacebookDomainInsights_SiteConfig_DataExtension extends DataExtension
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
13
{
14
15
16
    /* Overload Model
17
    ------------------------------------------------------------------------------*/
18
19
    private static $db = array(
0 ignored issues
show
Unused Code introduced by
The property $db is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
20
        'FacebookAppID' => 'Varchar(16)',
21
    );
22
    private static $has_many = array(
0 ignored issues
show
Unused Code introduced by
The property $has_many is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
23
        'FacebookAdmins' => 'Member',
24
    );
25
26
27
    /* Overload Methods
28
    ------------------------------------------------------------------------------*/
29
30
    // CMS Fields
31
    public function updateCMSFields(FieldList $fields)
32
    {
33
34
        // owner
35
        $owner = $this->owner;
36
37
        //// Facebook Insights
38
39
        // tab
40
        $tab = 'Root.Metadata.FacebookDomainInsights';
41
42
        // add fields
43
        $fields->addFieldsToTab($tab, array(
44
            TextField::create('FacebookAppID', 'Facebook Application ID'), // @todo validation
45
            GridField::create('FacebookAdmins', 'Facebook Administrators', $owner->FacebookAdmins())
46
                ->setConfig(GridFieldConfig_RelationEditor::create())
47
        ));
48
49
    }
50
51
}
52