mirror of
https://github.com/silverstripe/silverstripe-dms
synced 2024-10-22 14:05:56 +02:00
d29a115f7b
The add new button wasn't modular so have added a GridField component which can be reused
33 lines
915 B
PHP
33 lines
915 B
PHP
<?php
|
|
|
|
class DMSDocumentAdmin extends ModelAdmin
|
|
{
|
|
private static $managed_models = array(
|
|
'DMSDocument'
|
|
);
|
|
|
|
private static $url_segment = 'documents';
|
|
|
|
private static $menu_title = 'Documents';
|
|
|
|
/**
|
|
* Remove the default "add" button and replace it with a customised version for DMS
|
|
*
|
|
* @return CMSForm
|
|
*/
|
|
public function getEditForm($id = null, $fields = null)
|
|
{
|
|
/** @var CMSForm $form */
|
|
$form = parent::getEditForm($id, $fields);
|
|
|
|
// See parent class
|
|
$gridFieldName = $this->sanitiseClassName($this->modelClass);
|
|
|
|
$gridFieldConfig = $form->Fields()->fieldByName($gridFieldName)->getConfig();
|
|
$gridFieldConfig->removeComponentsByType('GridFieldAddNewButton');
|
|
$gridFieldConfig->addComponent(new DMSGridFieldAddNewButton('buttons-before-left'), 'GridFieldExportButton');
|
|
|
|
return $form;
|
|
}
|
|
}
|