Skip to content

Commit 7ad58bb

Browse files
committed
API Deprecate widget classes
1 parent bb49ba8 commit 7ad58bb

12 files changed

+178
-4
lines changed

src/Model/BlogPostFeaturedExtension.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,28 @@
55
use SilverStripe\ORM\DataExtension;
66
use SilverStripe\Forms\FieldList;
77
use SilverStripe\Forms\CheckboxField;
8+
use SilverStripe\Dev\Deprecation;
89

910
/**
1011
* Adds a checkbox field for featured blog posts widget.
1112
*
1213
* @extends DataExtension<BlogPost>
14+
* @deprecated 4.3.0 Will be removed without equivalent functionality to replace it
1315
*/
1416
class BlogPostFeaturedExtension extends DataExtension
1517
{
18+
public function __construct()
19+
{
20+
Deprecation::withNoReplacement(function () {
21+
Deprecation::notice(
22+
'4.3.0',
23+
'Will be removed without equivalent functionality to replace it',
24+
Deprecation::SCOPE_CLASS
25+
);
26+
});
27+
parent::__construct();
28+
}
29+
1630
/**
1731
* @var array
1832
*/

src/Widgets/BlogArchiveWidget.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
use SilverStripe\Versioned\Versioned;
1717
use SilverStripe\View\ArrayData;
1818
use SilverStripe\Widgets\Model\Widget;
19+
use SilverStripe\Dev\Deprecation;
20+
use SilverStripe\ORM\DataObject;
1921

2022
if (!class_exists(Widget::class)) {
2123
return;
@@ -26,6 +28,7 @@
2628
*
2729
* @property string $ArchiveType
2830
* @property int $NumberToDisplay
31+
* @deprecated 4.3.0 Will be removed without equivalent functionality to replace it
2932
*/
3033
class BlogArchiveWidget extends Widget
3134
{
@@ -71,6 +74,18 @@ class BlogArchiveWidget extends Widget
7174
*/
7275
private static $table_name = 'BlogArchiveWidget';
7376

77+
public function __construct($record = [], $creationType = DataObject::CREATE_OBJECT, $queryParams = [])
78+
{
79+
Deprecation::withNoReplacement(function () {
80+
Deprecation::notice(
81+
'4.3.0',
82+
'Will be removed without equivalent functionality to replace it',
83+
Deprecation::SCOPE_CLASS
84+
);
85+
});
86+
parent::__construct($record, $creationType, $queryParams);
87+
}
88+
7489
/**
7590
* {@inheritdoc}
7691
*/

src/Widgets/BlogArchiveWidgetController.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,26 @@
33
namespace SilverStripe\Blog\Widgets;
44

55
use SilverStripe\Widgets\Model\WidgetController;
6+
use SilverStripe\Dev\Deprecation;
67

78
if (!class_exists(WidgetController::class)) {
89
return;
910
}
1011

12+
/**
13+
* @deprecated 4.3.0 Will be removed without equivalent functionality to replace it
14+
*/
1115
class BlogArchiveWidgetController extends WidgetController
1216
{
13-
17+
public function __construct($widget = null)
18+
{
19+
Deprecation::withNoReplacement(function () {
20+
Deprecation::notice(
21+
'4.3.0',
22+
'Will be removed without equivalent functionality to replace it',
23+
Deprecation::SCOPE_CLASS
24+
);
25+
});
26+
parent::__construct($widget);
27+
}
1428
}

src/Widgets/BlogCategoriesWidget.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,16 @@
1010
use SilverStripe\Forms\NumericField;
1111
use SilverStripe\ORM\DataList;
1212
use SilverStripe\Widgets\Model\Widget;
13+
use SilverStripe\Dev\Deprecation;
14+
use SilverStripe\ORM\DataObject;
1315

1416
if (!class_exists(Widget::class)) {
1517
return;
1618
}
1719

1820
/**
1921
* @method Blog Blog()
22+
* @deprecated 4.3.0 Will be removed without equivalent functionality to replace it
2023
*/
2124
class BlogCategoriesWidget extends Widget
2225
{
@@ -56,6 +59,18 @@ class BlogCategoriesWidget extends Widget
5659
*/
5760
private static $table_name = 'BlogCategoriesWidget';
5861

62+
public function __construct($record = [], $creationType = DataObject::CREATE_OBJECT, $queryParams = [])
63+
{
64+
Deprecation::withNoReplacement(function () {
65+
Deprecation::notice(
66+
'4.3.0',
67+
'Will be removed without equivalent functionality to replace it',
68+
Deprecation::SCOPE_CLASS
69+
);
70+
});
71+
parent::__construct($record, $creationType, $queryParams);
72+
}
73+
5974
/**
6075
* {@inheritdoc}
6176
*/

src/Widgets/BlogCategoriesWidgetController.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,26 @@
33
namespace SilverStripe\Blog\Widgets;
44

55
use SilverStripe\Widgets\Model\WidgetController;
6+
use SilverStripe\Dev\Deprecation;
67

78
if (!class_exists(WidgetController::class)) {
89
return;
910
}
1011

12+
/**
13+
* @deprecated 4.3.0 Will be removed without equivalent functionality to replace it
14+
*/
1115
class BlogCategoriesWidgetController extends WidgetController
1216
{
13-
17+
public function __construct($widget = null)
18+
{
19+
Deprecation::withNoReplacement(function () {
20+
Deprecation::notice(
21+
'4.3.0',
22+
'Will be removed without equivalent functionality to replace it',
23+
Deprecation::SCOPE_CLASS
24+
);
25+
});
26+
parent::__construct($widget);
27+
}
1428
}

src/Widgets/BlogFeaturedPostsWidget.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
use SilverStripe\Forms\NumericField;
1010
use SilverStripe\ORM\DataList;
1111
use SilverStripe\Widgets\Model\Widget;
12+
use SilverStripe\Dev\Deprecation;
13+
use SilverStripe\ORM\DataObject;
1214

1315
if (!class_exists(Widget::class)) {
1416
return;
@@ -18,6 +20,7 @@
1820
* @method Blog Blog()
1921
*
2022
* @property int $NumberOfPosts
23+
* @deprecated 4.3.0 Will be removed without equivalent functionality to replace it
2124
*/
2225
class BlogFeaturedPostsWidget extends Widget
2326
{
@@ -55,6 +58,18 @@ class BlogFeaturedPostsWidget extends Widget
5558
*/
5659
private static $table_name = 'BlogFeaturedPostsWidget';
5760

61+
public function __construct($record = [], $creationType = DataObject::CREATE_OBJECT, $queryParams = [])
62+
{
63+
Deprecation::withNoReplacement(function () {
64+
Deprecation::notice(
65+
'4.3.0',
66+
'Will be removed without equivalent functionality to replace it',
67+
Deprecation::SCOPE_CLASS
68+
);
69+
});
70+
parent::__construct($record, $creationType, $queryParams);
71+
}
72+
5873
/**
5974
* {@inheritdoc}
6075
*/

src/Widgets/BlogRecentPostsWidget.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
use SilverStripe\Forms\NumericField;
1010
use SilverStripe\ORM\DataList;
1111
use SilverStripe\Widgets\Model\Widget;
12+
use SilverStripe\ORM\DataObject;
13+
use SilverStripe\Dev\Deprecation;
1214

1315
if (!class_exists(Widget::class)) {
1416
return;
@@ -18,6 +20,7 @@
1820
* @method Blog Blog()
1921
*
2022
* @property int $NumberOfPosts
23+
* @deprecated 4.3.0 Will be removed without equivalent functionality to replace it
2124
*/
2225
class BlogRecentPostsWidget extends Widget
2326
{
@@ -55,6 +58,18 @@ class BlogRecentPostsWidget extends Widget
5558
*/
5659
private static $table_name = 'BlogRecentPostsWidget';
5760

61+
public function __construct($record = [], $creationType = DataObject::CREATE_OBJECT, $queryParams = [])
62+
{
63+
Deprecation::withNoReplacement(function () {
64+
Deprecation::notice(
65+
'4.3.0',
66+
'Will be removed without equivalent functionality to replace it',
67+
Deprecation::SCOPE_CLASS
68+
);
69+
});
70+
parent::__construct($record, $creationType, $queryParams);
71+
}
72+
5873
/**
5974
* {@inheritdoc}
6075
*/

src/Widgets/BlogRecentPostsWidgetController.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,26 @@
33
namespace SilverStripe\Blog\Widgets;
44

55
use SilverStripe\Widgets\Model\WidgetController;
6+
use SilverStripe\Dev\Deprecation;
67

78
if (!class_exists(WidgetController::class)) {
89
return;
910
}
1011

12+
/**
13+
* @deprecated 4.3.0 Will be removed without equivalent functionality to replace it
14+
*/
1115
class BlogRecentPostsWidgetController extends WidgetController
1216
{
13-
17+
public function __construct($widget = null)
18+
{
19+
Deprecation::withNoReplacement(function () {
20+
Deprecation::notice(
21+
'4.3.0',
22+
'Will be removed without equivalent functionality to replace it',
23+
Deprecation::SCOPE_CLASS
24+
);
25+
});
26+
parent::__construct($widget);
27+
}
1428
}

src/Widgets/BlogTagsCloudWidget.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@
1010
use SilverStripe\ORM\DB;
1111
use SilverStripe\Widgets\Model\Widget;
1212
use SilverStripe\Control\Controller;
13+
use SilverStripe\Dev\Deprecation;
1314

1415
if (!class_exists(Widget::class)) {
1516
return;
1617
}
1718

1819
/**
1920
* @method Blog Blog()
21+
* @deprecated 4.3.0 Will be removed without equivalent functionality to replace it
2022
*/
2123
class BlogTagsCloudWidget extends Widget
2224
{
@@ -52,6 +54,18 @@ class BlogTagsCloudWidget extends Widget
5254
*/
5355
private static $table_name = 'BlogTagsCloudWidget';
5456

57+
public function __construct($record = [], $creationType = DataObject::CREATE_OBJECT, $queryParams = [])
58+
{
59+
Deprecation::withNoReplacement(function () {
60+
Deprecation::notice(
61+
'4.3.0',
62+
'Will be removed without equivalent functionality to replace it',
63+
Deprecation::SCOPE_CLASS
64+
);
65+
});
66+
parent::__construct($record, $creationType, $queryParams);
67+
}
68+
5569
/**
5670
* {@inheritdoc}
5771
*/

src/Widgets/BlogTagsCloudWidgetController.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,26 @@
33
namespace SilverStripe\Blog\Widgets;
44

55
use SilverStripe\Widgets\Model\WidgetController;
6+
use SilverStripe\Dev\Deprecation;
67

78
if (!class_exists(WidgetController::class)) {
89
return;
910
}
1011

12+
/**
13+
* @deprecated 4.3.0 Will be removed without equivalent functionality to replace it
14+
*/
1115
class BlogTagsCloudWidgetController extends WidgetController
1216
{
17+
public function __construct($widget = null)
18+
{
19+
Deprecation::withNoReplacement(function () {
20+
Deprecation::notice(
21+
'4.3.0',
22+
'Will be removed without equivalent functionality to replace it',
23+
Deprecation::SCOPE_CLASS
24+
);
25+
});
26+
parent::__construct($widget);
27+
}
1328
}

0 commit comments

Comments
 (0)