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 28, 2024
1 parent d63e213 commit d9402c1
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 17 deletions.
6 changes: 3 additions & 3 deletions src/Extensions/ElementalAreaUsedOnTableExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
namespace DNADesign\Elemental\Extensions;

use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\ORM\DataExtension;
use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\ValidationException;
use DNADesign\Elemental\Models\ElementalArea;
use DNADesign\Elemental\Models\BaseElement;
use SilverStripe\Admin\Forms\UsedOnTable;
use SilverStripe\Core\Extension;

/**
* @extends DataExtension<UsedOnTable>
* @extends Extension<UsedOnTable>
*/
class ElementalAreaUsedOnTableExtension extends DataExtension
class ElementalAreaUsedOnTableExtension extends Extension
{
/**
* Hides ElementalArea's from the "Used On" tab when viewing files
Expand Down
8 changes: 3 additions & 5 deletions src/Extensions/ElementalAreasExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
use SilverStripe\Core\Extensible;
use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\LiteralField;
use SilverStripe\ORM\DataExtension;
use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\RelatedData\StandardRelatedDataService;
use SilverStripe\Versioned\Versioned;
use SilverStripe\View\ViewableData;
use SilverStripe\Core\Extension;

/**
* This extension handles most of the relationships between pages and element
Expand All @@ -44,9 +44,9 @@
* );
*
* @template T of DataObject
* @extends DataExtension<T&static>
* @extends Extension<T&static>
*/
class ElementalAreasExtension extends DataExtension
class ElementalAreasExtension extends Extension
{
use Extensible;

Expand Down Expand Up @@ -220,8 +220,6 @@ protected function updateCMSFields(FieldList $fields)
*/
protected function onBeforeWrite()
{
parent::onBeforeWrite();

if (!$this->supportsElemental()) {
return;
}
Expand Down
6 changes: 3 additions & 3 deletions src/TopPage/DataExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
use DNADesign\Elemental\Models\ElementalArea;
use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Core\ClassInfo;
use SilverStripe\ORM\DataExtension as BaseDataExtension;
use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\Queries\SQLUpdate;
use SilverStripe\ORM\ValidationException;
use SilverStripe\View\ViewableData;
use SilverStripe\Forms\FieldList;
use SilverStripe\Core\Extension;

/**
* Class DataExtension
Expand All @@ -22,9 +22,9 @@
* @property int $TopPageID
* @method SiteTree TopPage()
*
* @extends BaseDataExtension<BaseElement|ElementalArea|static>
* @extends Extension<BaseElement|ElementalArea|static>
*/
class DataExtension extends BaseDataExtension
class DataExtension extends Extension
{
/**
* @config
Expand Down
6 changes: 2 additions & 4 deletions src/TopPage/SiteTreeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,17 @@

use DNADesign\Elemental\Extensions\ElementalPageExtension;
use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\CMS\Model\SiteTreeExtension as BaseSiteTreeExtension;
use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\ValidationException;
use SilverStripe\Core\Extension;

/**
* Class SiteTreeExtension
*
* This extension must be present on pagetypes that need to support Elemental TopPage functionality.
* It can be applied directly to Page, as it only takes effect in the presence of a ElementalArea.
*
* @extends BaseSiteTreeExtension<SiteTree&ElementalPageExtension&static>
*/
class SiteTreeExtension extends BaseSiteTreeExtension
class SiteTreeExtension extends Extension
{
/**
* List of pages currently undergoing duplication
Expand Down
4 changes: 2 additions & 2 deletions tests/Src/TestElementContentExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace DNADesign\Elemental\Tests\Src;

use SilverStripe\ORM\DataExtension;
use SilverStripe\Dev\TestOnly;
use SilverStripe\Core\Extension;

class TestElementContentExtension extends DataExtension implements TestOnly
class TestElementContentExtension extends Extension implements TestOnly
{
private static $db = [
'UnrenderedField' => 'Varchar(255)',
Expand Down

0 comments on commit d9402c1

Please sign in to comment.