Modifies GridFields & GridField detail forms to use standard page edit form (with versioning, history & settings)., (*1)
Best used in combination with:
* silverstripe-excludechildren module to hide pages from the sitetree, (*2)
Or use/subclass the preconfigured GridfieldPages module, which contains both the excludechildren module and this sitetreebuttons module:
* silverstripe-gridfieldpages, (*3)
Screenshot
Manage (add & edit) SiteTree items from a GridField:
, (*4)
Usage
In GridFieldConfig, replace
GridFieldAddNewButton('toolbar-header-right')
with
GridFieldAddNewSiteTreeItemButton('toolbar-header-right')
and
new GridFieldDetailForm()
with
GridFieldEditSiteTreeItemButton(), (*5)
Like this:, (*6)
$gfconf = GridFieldConfig_RecordEditor::create();
$gfconf->removeComponentsByType('GridFieldAddNewButton');
$gfconf->addComponent(new GridFieldAddNewSiteTreeItemButton('toolbar-header-right'));
$gfconf->removeComponentsByType('GridFieldAddNewButton');
$gfconf->addComponent(new GridFieldEditSiteTreeItemButton());
Requirements
SilverStripe 3.0 or higher, (*7)
Pro tip
Use/subclass the prefabricated GridfieldPages module as a all-in-one base:
* silverstripe-gridfieldpages, (*8)