Skip to content

Commit

Permalink
API Replace Extension subclasses
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Aug 25, 2024
1 parent 2d158e9 commit d7a9d8f
Show file tree
Hide file tree
Showing 13 changed files with 20 additions and 131 deletions.
2 changes: 0 additions & 2 deletions code/Controllers/CMSMain.php
Original file line number Diff line number Diff line change
Expand Up @@ -1833,8 +1833,6 @@ public function save(array $data, Form $form): HTTPResponse
}

/**
* @uses LeftAndMainExtension->augmentNewSiteTreeItem()
*
* @param int|string $id
* @param bool $setID
* @return mixed|DataObject
Expand Down
3 changes: 0 additions & 3 deletions code/Model/SiteTree.php
Original file line number Diff line number Diff line change
Expand Up @@ -1137,7 +1137,6 @@ public function canAddChildren($member = null)
* - "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
Expand Down Expand Up @@ -1284,7 +1283,6 @@ public function canDelete($member = null)
* 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]
Expand Down Expand Up @@ -1341,7 +1339,6 @@ public function canCreate($member = null, $context = [])
*
* @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)
Expand Down
106 changes: 0 additions & 106 deletions code/Model/SiteTreeExtension.php

This file was deleted.

6 changes: 3 additions & 3 deletions code/Model/SiteTreeLinkTracking.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
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.
Expand All @@ -29,9 +29,9 @@
* @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
Expand Down
2 changes: 1 addition & 1 deletion tests/behat/features/insert-anchor-link.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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 and flush only
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>"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down
4 changes: 2 additions & 2 deletions tests/php/Model/SiteTreeBacklinksTest_DOD.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
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',
Expand Down
4 changes: 2 additions & 2 deletions tests/php/Model/SiteTreeLinkTracking_Extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
4 changes: 2 additions & 2 deletions tests/php/Model/SiteTreeTest_AdminDeniedExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
public function canCreate($member)
{
Expand Down
4 changes: 2 additions & 2 deletions tests/php/Model/SiteTreeTest_Extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down
4 changes: 2 additions & 2 deletions tests/php/Model/SiteTreeTest_ExtensionA.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions tests/php/Model/SiteTreeTest_ExtensionB.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions tests/php/Model/VirtualPageTest_PageExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit d7a9d8f

Please sign in to comment.