diff --git a/.upgrade.yml b/.upgrade.yml index 44f389c..813650c 100644 --- a/.upgrade.yml +++ b/.upgrade.yml @@ -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 diff --git a/src/Model/BlogFilter.php b/src/Model/BlogFilter.php index 48c1c37..5594354 100644 --- a/src/Model/BlogFilter.php +++ b/src/Model/BlogFilter.php @@ -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; - } -} diff --git a/src/Model/BlogFilter/BlogFilterGridField.php b/src/Model/BlogFilter/BlogFilterGridField.php new file mode 100644 index 0000000..4ad64d6 --- /dev/null +++ b/src/Model/BlogFilter/BlogFilterGridField.php @@ -0,0 +1,21 @@ +