2019-04-10 15:31:25 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace SilverStripe\Blog\Model;
|
|
|
|
|
|
|
|
use SilverStripe\ORM\DataExtension;
|
|
|
|
use SilverStripe\Forms\FieldList;
|
|
|
|
use SilverStripe\Forms\CheckboxField;
|
2024-08-20 03:29:04 +02:00
|
|
|
use SilverStripe\Dev\Deprecation;
|
2019-04-10 15:31:25 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds a checkbox field for featured blog posts widget.
|
2024-01-18 21:58:02 +01:00
|
|
|
*
|
|
|
|
* @extends DataExtension<BlogPost>
|
2024-08-20 03:29:04 +02:00
|
|
|
* @deprecated 4.3.0 Will be removed without equivalent functionality to replace it
|
2019-04-10 15:31:25 +02:00
|
|
|
*/
|
|
|
|
class BlogPostFeaturedExtension extends DataExtension
|
|
|
|
{
|
2024-08-20 03:29:04 +02:00
|
|
|
public function __construct()
|
|
|
|
{
|
2024-09-19 03:45:08 +02:00
|
|
|
Deprecation::withSuppressedNotice(function () {
|
2024-08-20 03:29:04 +02:00
|
|
|
Deprecation::notice(
|
|
|
|
'4.3.0',
|
|
|
|
'Will be removed without equivalent functionality to replace it',
|
|
|
|
Deprecation::SCOPE_CLASS
|
|
|
|
);
|
|
|
|
});
|
|
|
|
parent::__construct();
|
|
|
|
}
|
|
|
|
|
2019-04-10 15:31:25 +02:00
|
|
|
/**
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
private static $db = [
|
|
|
|
'FeaturedInWidget' => 'Boolean',
|
|
|
|
];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*/
|
|
|
|
public function updateCMSFields(FieldList $fields)
|
|
|
|
{
|
|
|
|
// Add the checkbox in.
|
|
|
|
$fields->addFieldToTab(
|
|
|
|
'Root.PostOptions',
|
2019-04-12 05:35:41 +02:00
|
|
|
CheckboxField::create('FeaturedInWidget', _t(__CLASS__ . '.FEATURED', 'Include Post in Feature Widget'))
|
2019-04-10 15:31:25 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|