GridFieldBulkEditingTools
GridFieldBulkEditingTools copied to clipboard
Add Model Admin example to ReadMe
Thought it would be good to add an example to the docs on how to allow bulk editing on a Model Admin interface. Adapting instructions from BlackDog, you end up with (where MyDataObject is the class the gridfield is showing)
class MyDataObjectAdminBulkManagerExtension extends Extension {
function updateEditForm(&$form) {
if($this->owner->modelClass == 'MyDataObject') {
//Update the automatically generated Model Admin interface with bulk editing capabilities
$form->Fields()->fieldByName('MyDataObject')->getConfig()->addComponent(new GridFieldBulkManager());
}
}
}
and apply extension to relevant model admin instance via yml config with
MyDataObjectAdmin:
extensions:
- MyDataObjectAdminBulkManagerExtension