API Replace Extension subclasses

This commit is contained in:
Steve Boyd 2024-08-20 16:04:48 +12:00
parent 63af1fb3c9
commit 6799b181a9
6 changed files with 19 additions and 19 deletions

View File

@ -47,8 +47,8 @@ SilverStripe\Blog\Model\BlogPost:
## Extension points in Blog and BlogPost users and how to use
Both Blog and BlogPost have methods which return the list of candidate users or authors. If the previously
mentioned methods of reducing this list are not suitable or you wish to roll your own, you can utilise a
DataExtension to get the control you require.
mentioned methods of reducing this list are not suitable or you wish to roll your own, you can utilise an
Extension to get the control you require.
For example in BlogPost:
@ -68,9 +68,9 @@ protected function getCandidateAuthors()
```
Note the line `$this->extend('updateCandidateAuthors', $list);` which allows you to call a
`updateCandidateAuthors` method in a DataExtension to the Blog Post class if you have not set a
`updateCandidateAuthors` method in a Extension to the Blog Post class if you have not set a
`restrict_authors_to_group` config, further filters the passed
in Member list before it gets sent back to the form field.
See the documentation on [DataExtension](https://docs.silverstripe.org/en/developer_guides/extending/extensions/) for further implementation notes.
See the documentation on [Extension](https://docs.silverstripe.org/en/developer_guides/extending/extensions/) for further implementation notes.

View File

@ -3,14 +3,14 @@
namespace SilverStripe\Blog\Model;
use SilverStripe\Comments\Model\Comment;
use SilverStripe\ORM\DataExtension;
use SilverStripe\Core\Extension;
/**
* Adds Blog specific behaviour to Comment.
*
* @extends DataExtension<Comment>
* @extends Extension<Comment>
*/
class BlogCommentExtension extends DataExtension
class BlogCommentExtension extends Extension
{
/**
* Extra CSS classes for styling different comment types.

View File

@ -9,11 +9,11 @@ use SilverStripe\Forms\GridField\GridField;
use SilverStripe\Forms\GridField\GridFieldAddNewButton;
use SilverStripe\Forms\Tab;
use SilverStripe\Forms\TextareaField;
use SilverStripe\ORM\DataExtension;
use SilverStripe\ORM\ManyManyList;
use SilverStripe\Security\Member;
use SilverStripe\View\Parsers\URLSegmentFilter;
use SilverStripe\View\Requirements;
use SilverStripe\Core\Extension;
/**
* This class is responsible for add Blog specific behaviour to Members.
@ -21,9 +21,9 @@ use SilverStripe\View\Requirements;
* @method ManyManyList<BlogPost> BlogPosts()
* @method Image BlogProfileImage()
*
* @extends DataExtension<Member>
* @extends Extension<Member>
*/
class BlogMemberExtension extends DataExtension
class BlogMemberExtension extends Extension
{
/**
* @var array

View File

@ -90,7 +90,7 @@ trait BlogObject
}
/**
* Inherits from the parent blog or can be overwritten using a DataExtension.
* Inherits from the parent blog or can be overwritten using an Extension.
*
* @param null|Member $member
*
@ -124,7 +124,7 @@ trait BlogObject
}
/**
* Inherits from the parent blog or can be overwritten using a DataExtension.
* Inherits from the parent blog or can be overwritten using an Extension.
*
* @param null|Member $member
*
@ -142,7 +142,7 @@ trait BlogObject
}
/**
* Inherits from the parent blog or can be overwritten using a DataExtension.
* Inherits from the parent blog or can be overwritten using an Extension.
*
* @param null|Member $member
*

View File

@ -5,21 +5,21 @@ namespace SilverStripe\Blog\Model;
use SilverStripe\Admin\LeftAndMain;
use SilverStripe\Control\Controller;
use SilverStripe\Core\Convert;
use SilverStripe\ORM\DataExtension;
use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\DataQuery;
use SilverStripe\ORM\FieldType\DBDatetime;
use SilverStripe\ORM\Queries\SQLSelect;
use SilverStripe\Security\Permission;
use SilverStripe\Versioned\Versioned;
use SilverStripe\Core\Extension;
/**
* This is responsible for filtering only published posts to users who do not have permission to
* view non-published posts.
*
* @extends DataExtension<BlogPost>
* @extends Extension<BlogPost>
*/
class BlogPostFilter extends DataExtension
class BlogPostFilter extends Extension
{
/**
* Augment queries so that we don't fetch unpublished articles.

View File

@ -4,18 +4,18 @@ namespace SilverStripe\Blog\Model;
use SilverStripe\Comments\Model\Comment;
use SilverStripe\Core\Config\Config;
use SilverStripe\ORM\DataExtension;
use SilverStripe\ORM\SS_List;
use SilverStripe\Security\Member;
use SilverStripe\Core\Extension;
/**
* Customise blog post to support comment notifications.
*
* Extends {@see BlogPost} with extensions to {@see CommentNotifiable}.
*
* @extends DataExtension<BlogPost>
* @extends Extension<BlogPost>
*/
class BlogPostNotifications extends DataExtension
class BlogPostNotifications extends Extension
{
/**
* Configure whether to send notifications even for spam comments