mirror of
https://github.com/silverstripe/silverstripe-dms
synced 2024-10-22 12:05:56 +00:00
FIX Don't show the upload field when inappropriate
This fix is quite ugly, but in theory, it's fine. By ugly, I mean the interface is kind of weird without it. Because 3.1 allows uploading when a DataObject doesn't exist, we need to override the new defaults to not allow such if the DO isn't saved yet.
This commit is contained in:
parent
144043c437
commit
8d4b24b68d
@ -57,6 +57,15 @@ class DMSUploadField extends UploadField {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public function isDisabled() {
|
||||
return (parent::isDisabled() || !$this->isSaveable());
|
||||
}
|
||||
|
||||
public function isSaveable() {
|
||||
return (!empty($this->getRecord()->ID));
|
||||
}
|
||||
|
||||
/**
|
||||
* Action to handle upload of a single file
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user