Completed
Push — master ( 1019e3...a8b42b )
by Robbie
01:39
created

BlogPostFeaturedExtension::updateCMSFields()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace SilverStripe\Blog\Model;
4
5
use SilverStripe\ORM\DataExtension;
6
use SilverStripe\Forms\FieldList;
7
use SilverStripe\Forms\CheckboxField;
8
9
/**
10
 * Adds a checkbox field for featured blog posts widget.
11
 */
12
class BlogPostFeaturedExtension extends DataExtension
13
{
14
    /**
15
     * @var array
16
     */
17
    private static $db = [
18
        'FeaturedInWidget' => 'Boolean',
19
    ];
20
21
    /**
22
     * {@inheritdoc}
23
     */
24
    public function updateCMSFields(FieldList $fields)
25
    {
26
        // Add the checkbox in.
27
        $fields->addFieldToTab(
28
            'Root.PostOptions',
29
            CheckboxField::create('FeaturedInWidget', _t(__CLASS__ . '.FEATURED', 'Include Post in Feature Widget'))
30
        );
31
    }
32
}
33