mirror of
https://github.com/silverstripe/silverstripe-dms
synced 2024-10-22 14:05:56 +02:00
ENHANCEMENT: Extensions are now the main method of providing custom functionality, replacing subclassing DMSDocument
This commit is contained in:
parent
3fea76c83a
commit
5150e66de3
@ -6,11 +6,6 @@ class DMS implements DMSInterface {
|
||||
//How many documents to store in a single folder. The square of this number is the maximum number of documents.
|
||||
//The number should be a multiple of 10
|
||||
static $dmsFolderSize = 1000;
|
||||
static $modelClass = 'DMSDocument';
|
||||
|
||||
static function set_model_class($className){
|
||||
self::$modelClass = $className;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@ -59,8 +54,7 @@ class DMS implements DMSInterface {
|
||||
$filePath = self::transform_file_to_file_path($file);
|
||||
|
||||
//create a new document and get its ID
|
||||
$modelClass = self::$modelClass;
|
||||
$doc = new $modelClass();
|
||||
$doc = new DMSDocument();
|
||||
$doc->write();
|
||||
$doc->storeDocument($filePath);
|
||||
|
||||
|
@ -556,6 +556,9 @@ class DMSDocument extends DataObject implements DMSDocumentInterface {
|
||||
$uploadField->addExtraClass('replace'),
|
||||
$pagesGrid->addExtraClass('find-usage')
|
||||
)->setName("ActionsPanel")->addExtraClass('dmsupload ss-uploadfield'));
|
||||
|
||||
$this->extend('updateCMSFields', $fields);
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
|
@ -22,8 +22,9 @@ class DMSSiteTreeExtension extends DataExtension {
|
||||
new GridFieldDetailForm()
|
||||
//GridFieldLevelup::create($folder->ID)->setLinkSpec('admin/assets/show/%d')
|
||||
);
|
||||
$modelClass = DMS::$modelClass;
|
||||
$gridFieldConfig->getComponentByType('GridFieldDataColumns')->setDisplayFields($modelClass::$display_fields)
|
||||
|
||||
singleton('DMSDocument');
|
||||
$gridFieldConfig->getComponentByType('GridFieldDataColumns')->setDisplayFields(Config::inst()->get('DMSDocument', 'display_fields'))
|
||||
->setFieldCasting(array('LastChanged'=>"Date->Ago"))
|
||||
->setFieldFormatting(array('FilenameWithoutID'=>'<a target=\'_blank\' class=\'file-url\' href=\'$DownloadLink\'>$FilenameWithoutID</a>'));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user