FIX GridField state was being added too late in the process which means no data was being passed through to create a new blog post.

This commit is contained in:
micmania1 2015-02-05 04:30:27 +00:00
parent 28703e1130
commit 9feee011cf
3 changed files with 15 additions and 8 deletions

View File

@ -12,8 +12,8 @@ class GridFieldConfig_BlogPost extends GridFieldConfig_Lumberjack {
public function __construct($itemsPerPage = null) {
parent::__construct($itemsPerPage);
$this->removeComponentsByType('SiteTreeEditButton');
$this->addComponent(new GridFieldSiteTreeEditButton());
$this->removeComponentsByType('GridFieldSiteTreeState');
$this->addComponent(new GridFieldBlogPostState());
}
}

View File

@ -69,11 +69,6 @@ class Blog extends Page {
});
$fields = parent::getCMSFields();
// Ensure we're using the BlogPost GridField config and not Lumberjack's
$gridField = $fields->dataFieldByName('ChildPages');
$gridField->setConfig(GridFieldConfig_BlogPost::create());
return $fields;
}
@ -131,6 +126,7 @@ class Blog extends Page {
}
/**
* This sets the title for our gridfield
*
@ -140,6 +136,17 @@ class Blog extends Page {
return _t('Blog.LumberjackTitle', 'Blog Posts');
}
/**
* This overwrites lumberjacks default gridfield config.
*
* @return GridFieldConfig
*/
public function getLumberjackGridFieldConfig() {
return GridFieldConfig_Blog::create();
}
}

View File

@ -5,7 +5,7 @@
"type": "silverstripe-module",
"require": {
"silverstripe/cms": "^3.1.0",
"micmania1/silverstripe-lumberjack": "^1.0.0"
"micmania1/silverstripe-lumberjack": "~1.1"
},
"license": "BSD-2-Clause",
"authors": [