CheckoutPageDataExtension   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A updateCMSFields() 0 7 1
1
<?php
2
3
namespace Sunnysideup\EcommerceGoogleAnalytics;
4
5
use SilverStripe\Forms\CheckboxField;
6
use SilverStripe\Forms\FieldList;
7
use SilverStripe\ORM\DataExtension;
8
9
/**
10
 * Class \Sunnysideup\EcommerceGoogleAnalytics\CheckoutPageDataExtension
11
 *
12
 * @property \Sunnysideup\Ecommerce\Pages\CheckoutPage|\Sunnysideup\EcommerceGoogleAnalytics\CheckoutPageDataExtension $owner
13
 * @property bool $EnableGoogleAnalytics
14
 */
15
class CheckoutPageDataExtension extends DataExtension
16
{
17
    /**
18
     * standard SS variable.
19
     *
20
     * @var array
21
     */
22
    private static $db = [
23
        'EnableGoogleAnalytics' => 'Boolean(1)',
24
    ];
25
26
    /**
27
     * @var string
28
     */
29
    private static $google_analytics_variable = 'ga';
30
31
    public function updateCMSFields(FieldList $fields)
32
    {
33
        $fields->addFieldToTab(
34
            'Root.Analytics',
35
            CheckboxField::create(
36
                'EnableGoogleAnalytics',
37
                'Enable E-commerce Google Analytics.  Make sure it is turned on in your Google Analytics account.'
38
            )
39
        );
40
    }
41
}
42