Skip to content

Commit

Permalink
ENH Add versioning to Link
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Sep 26, 2023
1 parent 7a16b8b commit 1ee8afd
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,18 @@ class Page extends SiteTree
'HasOneLink' => Link::class,
];

private static array $owns = [
'HasOneLink'
];

private static array $cascade_deletess = [
'HasOneLink'
];

private static array $cascade_duplicatess = [
'HasOneLink'
];

public function getCMSFields()
{
$fields = parent::getCMSFields();
Expand Down
1 change: 0 additions & 1 deletion _config.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@

// Avoid creating global variables
call_user_func(function () {

});
5 changes: 5 additions & 0 deletions src/Models/Link.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\FieldType\DBHTMLText;
use SilverStripe\View\Requirements;
use SilverStripe\Versioned\Versioned;

/**
* A Link Data Object. This class should be a subclass, and you should never directly interact with a plain Link
Expand All @@ -32,6 +33,10 @@ class Link extends DataObject implements JsonData, Type
'Title' => 'Varchar',
'OpenInNew' => 'Boolean',
];

private static array $extensions = [
Versioned::class,
];

/**
* In-memory only property used to change link type
Expand Down

0 comments on commit 1ee8afd

Please sign in to comment.