mirror of
https://github.com/silverstripe/silverstripe-blog
synced 2024-06-28 15:39:30 +02:00
35 lines
734 B
PHP
35 lines
734 B
PHP
|
<?php
|
||
|
|
||
|
namespace SilverStripe\Blog\Model;
|
||
|
|
||
|
use SilverStripe\ORM\DataExtension;
|
||
|
use SilverStripe\Forms\FieldList;
|
||
|
use SilverStripe\Forms\CheckboxField;
|
||
|
|
||
|
/**
|
||
|
* Adds a checkbox field for featured blog posts widget.
|
||
|
*/
|
||
|
class BlogPostFeaturedExtension extends DataExtension
|
||
|
{
|
||
|
/**
|
||
|
* @var array
|
||
|
*/
|
||
|
private static $db = [
|
||
|
'FeaturedInWidget' => 'Boolean',
|
||
|
];
|
||
|
|
||
|
/**
|
||
|
* {@inheritdoc}
|
||
|
*/
|
||
|
public function updateCMSFields(FieldList $fields)
|
||
|
{
|
||
|
// Add the checkbox in.
|
||
|
$fields->addFieldToTab(
|
||
|
'Root.PostOptions',
|
||
|
new CheckboxField("FeaturedInWidget", _t(__CLASS__ . '.FEATURED', 'Include Post in Feature Widget'))
|
||
|
);
|
||
|
|
||
|
return $fields;
|
||
|
}
|
||
|
}
|