Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Replace Extension subclasses #780

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/en/configuring-large-websites.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -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.

6 changes: 3 additions & 3 deletions src/Model/BlogCommentExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions src/Model/BlogMemberExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@
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.
*
* @method ManyManyList<BlogPost> BlogPosts()
* @method Image BlogProfileImage()
*
* @extends DataExtension<Member>
* @extends Extension<Member>
*/
class BlogMemberExtension extends DataExtension
class BlogMemberExtension extends Extension
{
/**
* @var array
Expand Down
6 changes: 3 additions & 3 deletions src/Model/BlogObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function getLink()
}

/**
* 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
*
Expand Down Expand Up @@ -124,7 +124,7 @@ public function canCreate($member = null, $context = [])
}

/**
* 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
*
Expand All @@ -142,7 +142,7 @@ public function canDelete($member = null)
}

/**
* 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
*
Expand Down
6 changes: 3 additions & 3 deletions src/Model/BlogPostFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@
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.
Expand Down
6 changes: 3 additions & 3 deletions src/Model/BlogPostNotifications.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@

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
Expand Down
Loading