silverstripe-blog/src/Model/BlogPostFeaturedExtension.php

49 lines
1.2 KiB
PHP
Raw Normal View History

<?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;
/**
* 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
*/
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();
}
/**
* @var array
*/
private static $db = [
'FeaturedInWidget' => 'Boolean',
];
/**
* {@inheritdoc}
*/
public function updateCMSFields(FieldList $fields)
{
// Add the checkbox in.
$fields->addFieldToTab(
'Root.PostOptions',
CheckboxField::create('FeaturedInWidget', _t(__CLASS__ . '.FEATURED', 'Include Post in Feature Widget'))
);
}
}