Skip to content

Commit

Permalink
Merge pull request #779 from creative-commoners/pulls/4/deprecate-wid…
Browse files Browse the repository at this point in the history
…gets

API Deprecate widget classes
  • Loading branch information
GuySartorelli committed Aug 20, 2024
2 parents bb49ba8 + 7ad58bb commit 92ea9d1
Show file tree
Hide file tree
Showing 12 changed files with 178 additions and 4 deletions.
14 changes: 14 additions & 0 deletions src/Model/BlogPostFeaturedExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,28 @@
use SilverStripe\ORM\DataExtension;
use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\CheckboxField;
use SilverStripe\Dev\Deprecation;

/**
* Adds a checkbox field for featured blog posts widget.
*
* @extends DataExtension<BlogPost>
* @deprecated 4.3.0 Will be removed without equivalent functionality to replace it
*/
class BlogPostFeaturedExtension extends DataExtension
{
public function __construct()
{
Deprecation::withNoReplacement(function () {
Deprecation::notice(
'4.3.0',
'Will be removed without equivalent functionality to replace it',
Deprecation::SCOPE_CLASS
);
});
parent::__construct();
}

/**
* @var array
*/
Expand Down
15 changes: 15 additions & 0 deletions src/Widgets/BlogArchiveWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
use SilverStripe\Versioned\Versioned;
use SilverStripe\View\ArrayData;
use SilverStripe\Widgets\Model\Widget;
use SilverStripe\Dev\Deprecation;
use SilverStripe\ORM\DataObject;

if (!class_exists(Widget::class)) {
return;
Expand All @@ -26,6 +28,7 @@
*
* @property string $ArchiveType
* @property int $NumberToDisplay
* @deprecated 4.3.0 Will be removed without equivalent functionality to replace it
*/
class BlogArchiveWidget extends Widget
{
Expand Down Expand Up @@ -71,6 +74,18 @@ class BlogArchiveWidget extends Widget
*/
private static $table_name = 'BlogArchiveWidget';

public function __construct($record = [], $creationType = DataObject::CREATE_OBJECT, $queryParams = [])
{
Deprecation::withNoReplacement(function () {
Deprecation::notice(
'4.3.0',
'Will be removed without equivalent functionality to replace it',
Deprecation::SCOPE_CLASS
);
});
parent::__construct($record, $creationType, $queryParams);
}

/**
* {@inheritdoc}
*/
Expand Down
16 changes: 15 additions & 1 deletion src/Widgets/BlogArchiveWidgetController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,26 @@
namespace SilverStripe\Blog\Widgets;

use SilverStripe\Widgets\Model\WidgetController;
use SilverStripe\Dev\Deprecation;

if (!class_exists(WidgetController::class)) {
return;
}

/**
* @deprecated 4.3.0 Will be removed without equivalent functionality to replace it
*/
class BlogArchiveWidgetController extends WidgetController
{

public function __construct($widget = null)
{
Deprecation::withNoReplacement(function () {
Deprecation::notice(
'4.3.0',
'Will be removed without equivalent functionality to replace it',
Deprecation::SCOPE_CLASS
);
});
parent::__construct($widget);
}
}
15 changes: 15 additions & 0 deletions src/Widgets/BlogCategoriesWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@
use SilverStripe\Forms\NumericField;
use SilverStripe\ORM\DataList;
use SilverStripe\Widgets\Model\Widget;
use SilverStripe\Dev\Deprecation;
use SilverStripe\ORM\DataObject;

if (!class_exists(Widget::class)) {
return;
}

/**
* @method Blog Blog()
* @deprecated 4.3.0 Will be removed without equivalent functionality to replace it
*/
class BlogCategoriesWidget extends Widget
{
Expand Down Expand Up @@ -56,6 +59,18 @@ class BlogCategoriesWidget extends Widget
*/
private static $table_name = 'BlogCategoriesWidget';

public function __construct($record = [], $creationType = DataObject::CREATE_OBJECT, $queryParams = [])
{
Deprecation::withNoReplacement(function () {
Deprecation::notice(
'4.3.0',
'Will be removed without equivalent functionality to replace it',
Deprecation::SCOPE_CLASS
);
});
parent::__construct($record, $creationType, $queryParams);
}

/**
* {@inheritdoc}
*/
Expand Down
16 changes: 15 additions & 1 deletion src/Widgets/BlogCategoriesWidgetController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,26 @@
namespace SilverStripe\Blog\Widgets;

use SilverStripe\Widgets\Model\WidgetController;
use SilverStripe\Dev\Deprecation;

if (!class_exists(WidgetController::class)) {
return;
}

/**
* @deprecated 4.3.0 Will be removed without equivalent functionality to replace it
*/
class BlogCategoriesWidgetController extends WidgetController
{

public function __construct($widget = null)
{
Deprecation::withNoReplacement(function () {
Deprecation::notice(
'4.3.0',
'Will be removed without equivalent functionality to replace it',
Deprecation::SCOPE_CLASS
);
});
parent::__construct($widget);
}
}
15 changes: 15 additions & 0 deletions src/Widgets/BlogFeaturedPostsWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
use SilverStripe\Forms\NumericField;
use SilverStripe\ORM\DataList;
use SilverStripe\Widgets\Model\Widget;
use SilverStripe\Dev\Deprecation;
use SilverStripe\ORM\DataObject;

if (!class_exists(Widget::class)) {
return;
Expand All @@ -18,6 +20,7 @@
* @method Blog Blog()
*
* @property int $NumberOfPosts
* @deprecated 4.3.0 Will be removed without equivalent functionality to replace it
*/
class BlogFeaturedPostsWidget extends Widget
{
Expand Down Expand Up @@ -55,6 +58,18 @@ class BlogFeaturedPostsWidget extends Widget
*/
private static $table_name = 'BlogFeaturedPostsWidget';

public function __construct($record = [], $creationType = DataObject::CREATE_OBJECT, $queryParams = [])
{
Deprecation::withNoReplacement(function () {
Deprecation::notice(
'4.3.0',
'Will be removed without equivalent functionality to replace it',
Deprecation::SCOPE_CLASS
);
});
parent::__construct($record, $creationType, $queryParams);
}

/**
* {@inheritdoc}
*/
Expand Down
15 changes: 15 additions & 0 deletions src/Widgets/BlogRecentPostsWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
use SilverStripe\Forms\NumericField;
use SilverStripe\ORM\DataList;
use SilverStripe\Widgets\Model\Widget;
use SilverStripe\ORM\DataObject;
use SilverStripe\Dev\Deprecation;

if (!class_exists(Widget::class)) {
return;
Expand All @@ -18,6 +20,7 @@
* @method Blog Blog()
*
* @property int $NumberOfPosts
* @deprecated 4.3.0 Will be removed without equivalent functionality to replace it
*/
class BlogRecentPostsWidget extends Widget
{
Expand Down Expand Up @@ -55,6 +58,18 @@ class BlogRecentPostsWidget extends Widget
*/
private static $table_name = 'BlogRecentPostsWidget';

public function __construct($record = [], $creationType = DataObject::CREATE_OBJECT, $queryParams = [])
{
Deprecation::withNoReplacement(function () {
Deprecation::notice(
'4.3.0',
'Will be removed without equivalent functionality to replace it',
Deprecation::SCOPE_CLASS
);
});
parent::__construct($record, $creationType, $queryParams);
}

/**
* {@inheritdoc}
*/
Expand Down
16 changes: 15 additions & 1 deletion src/Widgets/BlogRecentPostsWidgetController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,26 @@
namespace SilverStripe\Blog\Widgets;

use SilverStripe\Widgets\Model\WidgetController;
use SilverStripe\Dev\Deprecation;

if (!class_exists(WidgetController::class)) {
return;
}

/**
* @deprecated 4.3.0 Will be removed without equivalent functionality to replace it
*/
class BlogRecentPostsWidgetController extends WidgetController
{

public function __construct($widget = null)
{
Deprecation::withNoReplacement(function () {
Deprecation::notice(
'4.3.0',
'Will be removed without equivalent functionality to replace it',
Deprecation::SCOPE_CLASS
);
});
parent::__construct($widget);
}
}
14 changes: 14 additions & 0 deletions src/Widgets/BlogTagsCloudWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@
use SilverStripe\ORM\DB;
use SilverStripe\Widgets\Model\Widget;
use SilverStripe\Control\Controller;
use SilverStripe\Dev\Deprecation;

if (!class_exists(Widget::class)) {
return;
}

/**
* @method Blog Blog()
* @deprecated 4.3.0 Will be removed without equivalent functionality to replace it
*/
class BlogTagsCloudWidget extends Widget
{
Expand Down Expand Up @@ -52,6 +54,18 @@ class BlogTagsCloudWidget extends Widget
*/
private static $table_name = 'BlogTagsCloudWidget';

public function __construct($record = [], $creationType = DataObject::CREATE_OBJECT, $queryParams = [])
{
Deprecation::withNoReplacement(function () {
Deprecation::notice(
'4.3.0',
'Will be removed without equivalent functionality to replace it',
Deprecation::SCOPE_CLASS
);
});
parent::__construct($record, $creationType, $queryParams);
}

/**
* {@inheritdoc}
*/
Expand Down
15 changes: 15 additions & 0 deletions src/Widgets/BlogTagsCloudWidgetController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,26 @@
namespace SilverStripe\Blog\Widgets;

use SilverStripe\Widgets\Model\WidgetController;
use SilverStripe\Dev\Deprecation;

if (!class_exists(WidgetController::class)) {
return;
}

/**
* @deprecated 4.3.0 Will be removed without equivalent functionality to replace it
*/
class BlogTagsCloudWidgetController extends WidgetController
{
public function __construct($widget = null)
{
Deprecation::withNoReplacement(function () {
Deprecation::notice(
'4.3.0',
'Will be removed without equivalent functionality to replace it',
Deprecation::SCOPE_CLASS
);
});
parent::__construct($widget);
}
}
15 changes: 15 additions & 0 deletions src/Widgets/BlogTagsWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@
use SilverStripe\Forms\NumericField;
use SilverStripe\ORM\DataList;
use SilverStripe\Widgets\Model\Widget;
use SilverStripe\Dev\Deprecation;
use SilverStripe\ORM\DataObject;

if (!class_exists(Widget::class)) {
return;
}

/**
* @method Blog Blog()
* @deprecated 4.3.0 Will be removed without equivalent functionality to replace it
*/
class BlogTagsWidget extends Widget
{
Expand Down Expand Up @@ -56,6 +59,18 @@ class BlogTagsWidget extends Widget
*/
private static $table_name = 'BlogTagsWidget';

public function __construct($record = [], $creationType = DataObject::CREATE_OBJECT, $queryParams = [])
{
Deprecation::withNoReplacement(function () {
Deprecation::notice(
'4.3.0',
'Will be removed without equivalent functionality to replace it',
Deprecation::SCOPE_CLASS
);
});
parent::__construct($record, $creationType, $queryParams);
}

/**
* {@inheritdoc}
*/
Expand Down
16 changes: 15 additions & 1 deletion src/Widgets/BlogTagsWidgetController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,26 @@
namespace SilverStripe\Blog\Widgets;

use SilverStripe\Widgets\Model\WidgetController;
use SilverStripe\Dev\Deprecation;

if (!class_exists(WidgetController::class)) {
return;
}

/**
* @deprecated 4.3.0 Will be removed without equivalent functionality to replace it
*/
class BlogTagsWidgetController extends WidgetController
{

public function __construct($widget = null)
{
Deprecation::withNoReplacement(function () {
Deprecation::notice(
'4.3.0',
'Will be removed without equivalent functionality to replace it',
Deprecation::SCOPE_CLASS
);
});
parent::__construct($widget);
}
}

0 comments on commit 92ea9d1

Please sign in to comment.