mirror of
https://github.com/silverstripe/silverstripe-blog
synced 2024-10-22 11:05:58 +02:00
FIX Remove "Add new blog post" button from Blog Posts GridField in a members profile
This commit is contained in:
parent
836c7b4c22
commit
fffd2cece3
@ -6,6 +6,7 @@ use SilverStripe\Assets\Image;
|
|||||||
use SilverStripe\Blog\Forms\GridField\GridFieldConfigBlogPost;
|
use SilverStripe\Blog\Forms\GridField\GridFieldConfigBlogPost;
|
||||||
use SilverStripe\Forms\FieldList;
|
use SilverStripe\Forms\FieldList;
|
||||||
use SilverStripe\Forms\GridField\GridField;
|
use SilverStripe\Forms\GridField\GridField;
|
||||||
|
use SilverStripe\Forms\GridField\GridFieldAddNewButton;
|
||||||
use SilverStripe\Forms\Tab;
|
use SilverStripe\Forms\Tab;
|
||||||
use SilverStripe\ORM\DataExtension;
|
use SilverStripe\ORM\DataExtension;
|
||||||
use SilverStripe\Security\Member;
|
use SilverStripe\Security\Member;
|
||||||
@ -120,9 +121,12 @@ class BlogMemberExtension extends DataExtension
|
|||||||
'BlogPosts',
|
'BlogPosts',
|
||||||
_t(__CLASS__ . '.BLOGPOSTS', 'Blog Posts'),
|
_t(__CLASS__ . '.BLOGPOSTS', 'Blog Posts'),
|
||||||
$this->owner->BlogPosts(),
|
$this->owner->BlogPosts(),
|
||||||
GridFieldConfigBlogPost::create()
|
$gridFieldConfig = GridFieldConfigBlogPost::create()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Remove the "add new blog post" action from a member's profile
|
||||||
|
$gridFieldConfig->removeComponentsByType(GridFieldAddNewButton::class);
|
||||||
|
|
||||||
$tab->Fields()->add($gridField);
|
$tab->Fields()->add($gridField);
|
||||||
|
|
||||||
$fields->addFieldToTab('Root', $tab);
|
$fields->addFieldToTab('Root', $tab);
|
||||||
|
Loading…
Reference in New Issue
Block a user