Passed
Push — master ( 1a4aeb...c4d310 )
by Nicolaas
03:20
created

PageExtension   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A updateCMSFields() 0 10 1
1
<?php
2
3
namespace Sunnysideup\SimpleTemplateCaching\Extensions;
4
5
use SilverStripe\Forms\FieldList;
6
use SilverStripe\Forms\NumericField;
7
use SilverStripe\ORM\DataExtension;
8
9
class PageExtension extends DataExtension
10
{
11
    private static $db = [
12
        'PublicCacheDurationInSeconds' => 'Boolean',
13
    ];
14
15
    public function updateCMSFields(FieldList $fields)
16
    {
17
        $fields->addFieldToTab(
18
            'Root.Cache',
19
            NumericField::create(
20
                'PublicCacheDurationInSeconds',
21
                'Number of caching seconds for public users (0 = no caching)'
22
            )
23
                ->setDescription('Use with care. This should only be used on pages that should be the same for all users and that should be accessible publicly.'),
24
            'Content'
25
        );
26
    }
27
}
28