BUG UploadField overwriteWarning isn't working in AssetAdmin

When UploadField overwriteWarning is enabled, no overwrite warning message for uploading file in non-root folder. This fix will let CMSFileAddController know the current folder when 'fileexists' AJAX request is called.
This commit is contained in:
Jason 2017-10-12 14:40:48 +11:00 committed by Daniel Hensby
parent a0a5979eb6
commit fd39faeefd
No known key found for this signature in database
GPG Key ID: 5DE415D786BBB2FD
1 changed files with 5 additions and 0 deletions

View File

@ -102,6 +102,11 @@ class CMSFileAddController extends LeftAndMain {
)
);
$form->loadDataFrom($folder);
if($this->currentPageID()){
// Make sure this controller know current folder when AJAX 'fileexists' is fired.
$uploadField->setConfig('urlFileExists', Controller::join_links($uploadField->link('fileexists'), '?ID=' . $this->currentPageID()));
}
$this->extend('updateEditForm', $form);