Move BlogFilter_GridField to its own class

This commit is contained in:
Robbie Averill 2017-01-24 13:45:07 +13:00
parent bb08242edb
commit 3da05818af
3 changed files with 25 additions and 21 deletions

View File

@ -4,7 +4,7 @@ mappings:
GridFieldMergeAction: SilverStripe\Blog\Admin\GridFieldMergeAction
BlogCommentExtension: SilverStripe\Blog\Model\BlogCommentExtension
BlogFilter: SilverStripe\Blog\Model\BlogFilter
BlogFilter_GridField: SilverStripe\Blog\Model\BlogFilter_GridField
BlogFilter_GridField: SilverStripe\Blog\Model\BlogFilter\BlogFilterGridField
BlogMemberExtension: SilverStripe\Blog\Model\BlogMemberExtension
BlogPostFilter: SilverStripe\Blog\Model\BlogPostFilter
BlogPostNotifications: SilverStripe\Blog\Model\BlogPostNotifications

View File

@ -3,11 +3,11 @@
namespace SilverStripe\Blog\Model;
use SilverStripe\Blog\Model\Blog;
use SilverStripe\Blog\Model\BlogFilter\BlogFilterGridField;
use SilverStripe\Blog\Model\BlogPost;
use SilverStripe\Core\ClassInfo;
use SilverStripe\Core\Convert;
use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\FormTransformation;
use SilverStripe\Forms\GridField\GridField;
use SilverStripe\Forms\Tab;
use SilverStripe\Lumberjack\Model\Lumberjack;
@ -59,7 +59,7 @@ class BlogFilter extends Lumberjack
*/
protected function subclassForBlog()
{
return in_array(get_class($this->owner), ClassInfo::subclassesFor('SilverStripe\\Blog\\Model\\Blog'));
return in_array(get_class($this->owner), ClassInfo::subclassesFor(Blog::class));
}
/**
@ -104,7 +104,7 @@ class BlogFilter extends Lumberjack
'ClassName' => $excluded
));
$gridField = BlogFilter_GridField::create(
$gridField = BlogFilterGridField::create(
'ChildPages',
$this->getLumberjackTitle(),
$pages,
@ -117,20 +117,3 @@ class BlogFilter extends Lumberjack
}
}
}
/**
* Enables children of non-editable pages to be edited.
*/
class BlogFilter_GridField extends GridField
{
/**
* @param FormTransformation $transformation
*
* @return $this
*/
public function transform(FormTransformation $transformation)
{
return $this;
}
}

View File

@ -0,0 +1,21 @@
<?php
namespace SilverStripe\Blog\Model\BlogFilter;
use SilverStripe\Forms\FormTransformation;
/**
* Enables children of non-editable pages to be edited.
*/
class BlogFilterGridField extends GridField
{
/**
* @param FormTransformation $transformation
*
* @return $this
*/
public function transform(FormTransformation $transformation)
{
return $this;
}
}