API Mark moved classes in silverstripe-admin module as deprecated

This commit is contained in:
Sabina Talipova 2023-03-01 13:41:01 +13:00
parent 9269356ae9
commit 9ed5aa8b49
6 changed files with 107 additions and 5 deletions

View File

@ -4,6 +4,7 @@ namespace SilverStripe\CMS\Controllers;
use SilverStripe\ORM\CMSPreviewable; use SilverStripe\ORM\CMSPreviewable;
use SilverStripe\Core\ClassInfo; use SilverStripe\Core\ClassInfo;
use SilverStripe\Dev\Deprecation;
use SilverStripe\ORM\ArrayList; use SilverStripe\ORM\ArrayList;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\SS_List; use SilverStripe\ORM\SS_List;
@ -18,6 +19,9 @@ use SilverStripe\View\ViewableData;
* New item types can be defined by extending the {@link SilverStripeNavigatorItem} class, * New item types can be defined by extending the {@link SilverStripeNavigatorItem} class,
* for example the "cmsworkflow" module defines a new "future state" item with a date selector * for example the "cmsworkflow" module defines a new "future state" item with a date selector
* to view embargoed data at a future point in time. So the item doesn't always have to be a simple link. * to view embargoed data at a future point in time. So the item doesn't always have to be a simple link.
*
* Class will be moved from `silverstripe/cms` to `silverstripe/admin`
* @deprecated 4.13.0 Will be renamed SilverStripe\Admin\Navigator\SilverStripeNavigator
*/ */
class SilverStripeNavigator extends ViewableData class SilverStripeNavigator extends ViewableData
{ {
@ -32,6 +36,13 @@ class SilverStripeNavigator extends ViewableData
*/ */
public function __construct(CMSPreviewable $record) public function __construct(CMSPreviewable $record)
{ {
Deprecation::withNoReplacement(function () {
Deprecation::notice(
'4.13.0',
'Will be renamed SilverStripe\Admin\Navigator\SilverStripeNavigator',
Deprecation::SCOPE_CLASS
);
});
parent::__construct(); parent::__construct();
$this->record = $record; $this->record = $record;
} }

View File

@ -2,6 +2,7 @@
namespace SilverStripe\CMS\Controllers; namespace SilverStripe\CMS\Controllers;
use SilverStripe\Dev\Deprecation;
use SilverStripe\ORM\CMSPreviewable; use SilverStripe\ORM\CMSPreviewable;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\Versioned\Versioned; use SilverStripe\Versioned\Versioned;
@ -12,6 +13,9 @@ use SilverStripe\View\ViewableData;
* Navigator items are links that appear in the $SilverStripeNavigator bar. * Navigator items are links that appear in the $SilverStripeNavigator bar.
* To add an item, extend this class - it will be automatically picked up. * To add an item, extend this class - it will be automatically picked up.
* When instanciating items manually, please ensure to call {@link canView()}. * When instanciating items manually, please ensure to call {@link canView()}.
*
* Class have been moved from `silverstripe/cms` to `silverstripe/admin` and renamed.
* @deprecated Will be renamed SilverStripe\Admin\Navigator\SilverStripeNavigatorItem
*/ */
abstract class SilverStripeNavigatorItem extends ViewableData abstract class SilverStripeNavigatorItem extends ViewableData
{ {
@ -24,11 +28,26 @@ abstract class SilverStripeNavigatorItem extends ViewableData
/** @var string */ /** @var string */
protected $recordLink; protected $recordLink;
/**
* @param DataObject|CMSPreviewable $record
*/
public function __construct(CMSPreviewable $record) public function __construct(CMSPreviewable $record)
{ {
Deprecation::withNoReplacement(function () {
switch (static::class) {
// These classes have their own deprecation notice
case 'SilverStripe\CMS\Controllers\SilverStripeNavigatorItem_ArchiveLink':
case 'SilverStripe\CMS\Controllers\SilverStripeNavigatorItem_LiveLink':
case 'SilverStripe\CMS\Controllers\SilverStripeNavigatorItem_StageLink':
case 'SilverStripe\CMS\Controllers\SilverStripeNavigatorItem_Unversioned':
// This class is not deprecated and doesn't have a deprecation notice
case 'SilverStripe\CMS\Controllers\SilverStripeNavigatorItem_CMSLink':
break;
default:
Deprecation::notice(
'4.13.0',
'Will be renamed SilverStripe\Admin\Navigator\SilverStripeNavigatorItem',
Deprecation::SCOPE_CLASS
);
}
});
parent::__construct(); parent::__construct();
$this->record = $record; $this->record = $record;
} }

View File

@ -4,13 +4,34 @@ namespace SilverStripe\CMS\Controllers;
use SilverStripe\CMS\Model\RedirectorPage; use SilverStripe\CMS\Model\RedirectorPage;
use SilverStripe\Control\Controller; use SilverStripe\Control\Controller;
use SilverStripe\Core\Convert; use SilverStripe\Core\Convert;
use SilverStripe\Dev\Deprecation;
use SilverStripe\ORM\CMSPreviewable;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\FieldType\DBDatetime; use SilverStripe\ORM\FieldType\DBDatetime;
use SilverStripe\ORM\FieldType\DBField; use SilverStripe\ORM\FieldType\DBField;
use SilverStripe\Versioned\Versioned; use SilverStripe\Versioned\Versioned;
/**
* Class will be moved from `silverstripe/cms` to `silverstripe/admin`
* @deprecated 4.13.0 Will be renamed SilverStripe\VersionedAdmin\Navigator\SilverStripeNavigatorItem_ArchiveLink
*/
class SilverStripeNavigatorItem_ArchiveLink extends SilverStripeNavigatorItem class SilverStripeNavigatorItem_ArchiveLink extends SilverStripeNavigatorItem
{ {
/**
* @param DataObject|CMSPreviewable $record
*/
public function __construct(CMSPreviewable $record)
{
Deprecation::withNoReplacement(function () {
Deprecation::notice(
'4.13.0',
'Will be renamed SilverStripe\VersionedAdmin\Navigator\SilverStripeNavigatorItem_ArchiveLink',
Deprecation::SCOPE_CLASS
);
});
parent::__construct($record);
}
/** @config */ /** @config */
private static $priority = 40; private static $priority = 40;

View File

@ -1,15 +1,32 @@
<?php <?php
namespace SilverStripe\CMS\Controllers; namespace SilverStripe\CMS\Controllers;
use SilverStripe\CMS\Model\RedirectorPage;
use SilverStripe\Control\Controller; use SilverStripe\Control\Controller;
use SilverStripe\Core\Config\Config; use SilverStripe\Core\Config\Config;
use SilverStripe\Core\Convert; use SilverStripe\Core\Convert;
use SilverStripe\Dev\Deprecation;
use SilverStripe\ORM\CMSPreviewable;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\Versioned\Versioned; use SilverStripe\Versioned\Versioned;
/**
* Class will be moved from `silverstripe/cms` to `silverstripe/admin`.
* @deprecated 4.13.0 Will be renamed SilverStripe\VersionedAdmin\Navigator\SilverStripeNavigatorItem_LiveLink
*/
class SilverStripeNavigatorItem_LiveLink extends SilverStripeNavigatorItem class SilverStripeNavigatorItem_LiveLink extends SilverStripeNavigatorItem
{ {
public function __construct(CMSPreviewable $record)
{
Deprecation::withNoReplacement(function () {
Deprecation::notice(
'4.13.0',
'Will be renamed SilverStripe\VersionedAdmin\Navigator\SilverStripeNavigatorItem_LiveLink',
Deprecation::SCOPE_CLASS
);
});
parent::__construct($record);
}
/** @config */ /** @config */
private static $priority = 30; private static $priority = 30;

View File

@ -1,17 +1,33 @@
<?php <?php
namespace SilverStripe\CMS\Controllers; namespace SilverStripe\CMS\Controllers;
use SilverStripe\CMS\Model\RedirectorPage;
use SilverStripe\Control\Controller; use SilverStripe\Control\Controller;
use SilverStripe\Core\Config\Config; use SilverStripe\Core\Config\Config;
use SilverStripe\Core\ClassInfo; use SilverStripe\Core\ClassInfo;
use SilverStripe\Core\Convert; use SilverStripe\Core\Convert;
use SilverStripe\Dev\Deprecation;
use SilverStripe\ORM\CMSPreviewable;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\Versioned\Versioned; use SilverStripe\Versioned\Versioned;
use SiteTreeFutureState; use SiteTreeFutureState;
/**
* Class will be moved from `silverstripe/cms` to `silverstripe/admin`.
* @deprecated 4.13.0 Will be renamed SilverStripe\VersionedAdmin\Navigator\SilverStripeNavigatorItem_StageLink
*/
class SilverStripeNavigatorItem_StageLink extends SilverStripeNavigatorItem class SilverStripeNavigatorItem_StageLink extends SilverStripeNavigatorItem
{ {
public function __construct(CMSPreviewable $record)
{
Deprecation::withNoReplacement(function () {
Deprecation::notice(
'4.13.0',
'Will be renamed SilverStripe\VersionedAdmin\Navigator\SilverStripeNavigatorItem_StageLink',
Deprecation::SCOPE_CLASS
);
});
parent::__construct($record);
}
/** @config */ /** @config */
private static $priority = 20; private static $priority = 20;

View File

@ -5,11 +5,29 @@ namespace SilverStripe\CMS\Controllers;
use SilverStripe\CMS\Controllers\SilverStripeNavigatorItem; use SilverStripe\CMS\Controllers\SilverStripeNavigatorItem;
use SilverStripe\Core\Config\Config; use SilverStripe\Core\Config\Config;
use SilverStripe\Core\Convert; use SilverStripe\Core\Convert;
use SilverStripe\Dev\Deprecation;
use SilverStripe\ORM\CMSPreviewable;
use SilverStripe\Security\Member; use SilverStripe\Security\Member;
use SilverStripe\Versioned\Versioned; use SilverStripe\Versioned\Versioned;
/**
* Class will be moved from `silverstripe/cms` to `silverstripe/admin`.
* @deprecated 4.13.0 Will be renamed SilverStripe\Admin\Navigator\SilverStripeNavigatorItem_Unversioned
*/
class SilverStripeNavigatorItem_Unversioned extends SilverStripeNavigatorItem class SilverStripeNavigatorItem_Unversioned extends SilverStripeNavigatorItem
{ {
public function __construct(CMSPreviewable $record)
{
Deprecation::withNoReplacement(function () {
Deprecation::notice(
'4.13.0',
'Will be renamed SilverStripe\Admin\Navigator\SilverStripeNavigatorItem_Unversioned',
Deprecation::SCOPE_CLASS
);
});
parent::__construct($record);
}
public function getHTML() public function getHTML()
{ {
$recordLink = Convert::raw2att($this->getLink()); $recordLink = Convert::raw2att($this->getLink());