CheckoutPageDataExtension::updateCMSFields()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 5
c 0
b 0
f 0
dl 0
loc 7
rs 10
cc 1
nc 1
nop 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