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

PageExtension::updateCMSFields()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

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