mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
API Replace Extension subclasses
This commit is contained in:
parent
b40269c3c8
commit
344a7c548d
@ -1833,8 +1833,6 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
||||
}
|
||||
|
||||
/**
|
||||
* @uses LeftAndMainExtension->augmentNewSiteTreeItem()
|
||||
*
|
||||
* @param int|string $id
|
||||
* @param bool $setID
|
||||
* @return mixed|DataObject
|
||||
|
@ -1137,7 +1137,6 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
|
||||
* - "CanViewType" directive is set to "LoggedInUsers" and no user is logged in
|
||||
* - "CanViewType" directive is set to "OnlyTheseUsers" and user is not in the given groups
|
||||
*
|
||||
* @uses DataExtension->canView()
|
||||
* @uses ViewerGroups()
|
||||
*
|
||||
* @param Member $member
|
||||
@ -1284,7 +1283,6 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
|
||||
* Use {@link canAddChildren()} to control behaviour of creating children under this page.
|
||||
*
|
||||
* @uses $can_create
|
||||
* @uses DataExtension->canCreate()
|
||||
*
|
||||
* @param Member $member
|
||||
* @param array $context Optional array which may contain ['Parent' => $parentObj]
|
||||
@ -1341,7 +1339,6 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
|
||||
*
|
||||
* @uses canView()
|
||||
* @uses EditorGroups()
|
||||
* @uses DataExtension->canEdit()
|
||||
*
|
||||
* @param Member $member Set to false if you want to explicitly test permissions without a valid user (useful for
|
||||
* unit tests)
|
||||
|
@ -1,106 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Model;
|
||||
|
||||
use SilverStripe\ORM\DataExtension;
|
||||
use SilverStripe\Security\Member;
|
||||
use SilverStripe\Dev\Deprecation;
|
||||
use SilverStripe\Core\Extension;
|
||||
|
||||
/**
|
||||
* Plug-ins for additional functionality in your SiteTree classes.
|
||||
*
|
||||
* @template T of SiteTree
|
||||
* @extends DataExtension<T>
|
||||
* @deprecated 5.3.0 Subclass SilverStripe\Core\Extension\Extension instead
|
||||
*/
|
||||
abstract class SiteTreeExtension extends DataExtension
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
// Wrapping with Deprecation::withNoReplacement() to avoid triggering deprecation notices
|
||||
// as we are unable to update existing subclasses of this class until a new major
|
||||
// unless we add in the pointless empty methods that are in this class
|
||||
Deprecation::withNoReplacement(function () {
|
||||
$class = Extension::class;
|
||||
Deprecation::notice('5.3.0', "Subclass $class instead", Deprecation::SCOPE_CLASS);
|
||||
});
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook called before the page's {@link Versioned::publishSingle()} action is completed
|
||||
*
|
||||
* @param SiteTree &$original The current Live SiteTree record prior to publish
|
||||
*/
|
||||
protected function onBeforePublish(&$original)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook called after the page's {@link Versioned::publishSingle()} action is completed
|
||||
*
|
||||
* @param SiteTree &$original The current Live SiteTree record prior to publish
|
||||
*/
|
||||
protected function onAfterPublish(&$original)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook called before the page's {@link Versioned::doUnpublish()} action is completed
|
||||
*/
|
||||
protected function onBeforeUnpublish()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Hook called after the page's {@link SiteTree::doUnpublish()} action is completed
|
||||
*/
|
||||
protected function onAfterUnpublish()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook called to determine if a user may add children to this SiteTree object
|
||||
*
|
||||
* @see SiteTree::canAddChildren()
|
||||
*
|
||||
* @param Member $member The member to check permission against, or the currently
|
||||
* logged in user
|
||||
* @return boolean|null Return false to deny rights, or null to yield to default
|
||||
*/
|
||||
protected function canAddChildren($member)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook called to determine if a user may publish this SiteTree object
|
||||
*
|
||||
* @see SiteTree::canPublish()
|
||||
*
|
||||
* @param Member $member The member to check permission against, or the currently
|
||||
* logged in user
|
||||
* @return boolean|null Return false to deny rights, or null to yield to default
|
||||
*/
|
||||
protected function canPublish($member)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook called to modify the $base url of this page, with a given $action,
|
||||
* before {@link SiteTree::RelativeLink()} calls {@link Controller::join_links()}
|
||||
* on the $base and $action
|
||||
*
|
||||
* @param string &$link The URL of this page relative to siteroot including
|
||||
* the action
|
||||
* @param string $base The URL of this page relative to siteroot, not including
|
||||
* the action
|
||||
* @param string|boolean $action The action or subpage called on this page.
|
||||
* (Legacy support) If this is true, then do not reduce the 'home' urlsegment
|
||||
* to an empty link
|
||||
*/
|
||||
protected function updateRelativeLink(&$link, $base, $action)
|
||||
{
|
||||
}
|
||||
}
|
@ -6,12 +6,12 @@ use DOMElement;
|
||||
use SilverStripe\Assets\Shortcodes\FileLinkTracking;
|
||||
use SilverStripe\Forms\FieldList;
|
||||
use SilverStripe\Forms\FormScaffolder;
|
||||
use SilverStripe\ORM\DataExtension;
|
||||
use SilverStripe\ORM\DataObject;
|
||||
use SilverStripe\ORM\FieldType\DBHTMLText;
|
||||
use SilverStripe\ORM\ManyManyThroughList;
|
||||
use SilverStripe\Versioned\Versioned;
|
||||
use SilverStripe\View\Parsers\HTMLValue;
|
||||
use SilverStripe\Core\Extension;
|
||||
|
||||
/**
|
||||
* Adds tracking of links in any HTMLText fields which reference SiteTree or File items.
|
||||
@ -29,9 +29,9 @@ use SilverStripe\View\Parsers\HTMLValue;
|
||||
* @property DataObject|SiteTreeLinkTracking $owner
|
||||
* @method ManyManyThroughList<SiteTree> LinkTracking()
|
||||
*
|
||||
* @extends DataExtension<DataObject>
|
||||
* @extends Extension<DataObject>
|
||||
*/
|
||||
class SiteTreeLinkTracking extends DataExtension
|
||||
class SiteTreeLinkTracking extends Extension
|
||||
{
|
||||
/**
|
||||
* @var SiteTreeLinkTracking_Parser
|
||||
|
@ -5,7 +5,7 @@ I want to insert a link into my content
|
||||
So that I can link to a external website or a page on my site
|
||||
|
||||
Background:
|
||||
Given I add an extension "SilverStripe\CMS\Tests\Behaviour\AdditionalAnchorPageExtension" to the "Page" class
|
||||
Given I add an extension "SilverStripe\CMS\Tests\Behaviour\AdditionalAnchorPageExtension" to the "Page" class without dev-build
|
||||
And a "page" "Home"
|
||||
And a "page" "About Us" has the "Content" "<p>My awesome content</p>"
|
||||
And a "page" "Details" has the "Content" "<p>My sub-par content<a name="youranchor"></a></p>"
|
||||
|
@ -2,11 +2,11 @@
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Controllers\LeftAndMainpageIconsExtensionTest;
|
||||
|
||||
use SilverStripe\CMS\Model\SiteTreeExtension;
|
||||
use SilverStripe\Core\Manifest\ModuleResourceLoader;
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
use SilverStripe\Core\Extension;
|
||||
|
||||
class ModuleIconExtension extends SiteTreeExtension implements TestOnly
|
||||
class ModuleIconExtension extends Extension implements TestOnly
|
||||
{
|
||||
public static function get_extra_config()
|
||||
{
|
||||
|
@ -5,9 +5,9 @@ namespace SilverStripe\CMS\Tests\Model;
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
use SilverStripe\Forms\FieldList;
|
||||
use SilverStripe\Forms\HTMLEditor\HTMLEditorField;
|
||||
use SilverStripe\ORM\DataExtension;
|
||||
use SilverStripe\Core\Extension;
|
||||
|
||||
class SiteTreeBacklinksTest_DOD extends DataExtension implements TestOnly
|
||||
class SiteTreeBacklinksTest_DOD extends Extension implements TestOnly
|
||||
{
|
||||
private static $db = [
|
||||
'ExtraContent' => 'HTMLText',
|
||||
|
@ -3,9 +3,9 @@
|
||||
namespace SilverStripe\CMS\Tests\Model;
|
||||
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
use SilverStripe\ORM\DataExtension;
|
||||
use SilverStripe\Core\Extension;
|
||||
|
||||
class SiteTreeLinkTracking_Extension extends DataExtension implements TestOnly
|
||||
class SiteTreeLinkTracking_Extension extends Extension implements TestOnly
|
||||
{
|
||||
protected function updateAnchorsOnPage(&$anchors)
|
||||
{
|
||||
|
@ -3,12 +3,12 @@
|
||||
namespace SilverStripe\CMS\Tests\Model;
|
||||
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
use SilverStripe\ORM\DataExtension;
|
||||
use SilverStripe\Core\Extension;
|
||||
|
||||
/**
|
||||
* An extension that can even deny actions to admins
|
||||
*/
|
||||
class SiteTreeTest_AdminDeniedExtension extends DataExtension implements TestOnly
|
||||
class SiteTreeTest_AdminDeniedExtension extends Extension implements TestOnly
|
||||
{
|
||||
protected function canCreate($member)
|
||||
{
|
||||
|
@ -3,9 +3,9 @@
|
||||
namespace SilverStripe\CMS\Tests\Model;
|
||||
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
use SilverStripe\ORM\DataExtension;
|
||||
use SilverStripe\Core\Extension;
|
||||
|
||||
class SiteTreeTest_Extension extends DataExtension implements TestOnly
|
||||
class SiteTreeTest_Extension extends Extension implements TestOnly
|
||||
{
|
||||
protected function augmentValidURLSegment()
|
||||
{
|
||||
|
@ -2,11 +2,11 @@
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Model;
|
||||
|
||||
use SilverStripe\CMS\Model\SiteTreeExtension;
|
||||
use SilverStripe\Control\Controller;
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
use SilverStripe\Core\Extension;
|
||||
|
||||
class SiteTreeTest_ExtensionA extends SiteTreeExtension implements TestOnly
|
||||
class SiteTreeTest_ExtensionA extends Extension implements TestOnly
|
||||
{
|
||||
public static $can_publish = true;
|
||||
|
||||
|
@ -2,11 +2,11 @@
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Model;
|
||||
|
||||
use SilverStripe\CMS\Model\SiteTreeExtension;
|
||||
use SilverStripe\Control\Controller;
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
use SilverStripe\Core\Extension;
|
||||
|
||||
class SiteTreeTest_ExtensionB extends SiteTreeExtension implements TestOnly
|
||||
class SiteTreeTest_ExtensionB extends Extension implements TestOnly
|
||||
{
|
||||
public static $can_publish = true;
|
||||
|
||||
|
@ -3,9 +3,9 @@
|
||||
namespace SilverStripe\CMS\Tests\Model;
|
||||
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
use SilverStripe\ORM\DataExtension;
|
||||
use SilverStripe\Core\Extension;
|
||||
|
||||
class VirtualPageTest_PageExtension extends DataExtension implements TestOnly
|
||||
class VirtualPageTest_PageExtension extends Extension implements TestOnly
|
||||
{
|
||||
private static $db = [
|
||||
// These fields are just on an extension to simulate shared properties between Page and VirtualPage.
|
||||
|
Loading…
Reference in New Issue
Block a user