silverstripe-dms/code/cms/DMSDocumentAdmin.php
Robbie Averill 9b42effeb5 FIX Refactor SCSS, convert to more BEM-like names, add admin icon
* Remove "small" class from inline edit form for documents
* Swap relationeditor GridFieldConfig for record editor to ensure that document sets can be deleted from a page context rather than unlinked (natively)
* Fix to ensure that related documents can be autocompleted via partial matching on filename
* Add 2 space indentation rule to editorconfig for .js and .scss files
2017-05-22 15:20:16 +12:00

35 lines
983 B
PHP

<?php
class DMSDocumentAdmin extends ModelAdmin
{
private static $managed_models = array(
'DMSDocument'
);
private static $url_segment = 'documents';
private static $menu_title = 'Documents';
private static $menu_icon = 'dms/images/app_icons/drawer.png';
/**
* 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;
}
}