From 99fc24aca77f10753d5f01125c98156d5c40fe33 Mon Sep 17 00:00:00 2001 From: UndefinedOffset Date: Wed, 4 Sep 2019 14:55:06 -0300 Subject: [PATCH 1/3] FIX: Fixed URL generation for the file icons in the field --- src/FileAttachmentField.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/FileAttachmentField.php b/src/FileAttachmentField.php index be368f7..e3e8586 100644 --- a/src/FileAttachmentField.php +++ b/src/FileAttachmentField.php @@ -1139,7 +1139,7 @@ public function AttachedFiles() public function RootThumbnailsDir() { return $this->getSetting('thumbnailsDir') ?: - ModuleResourceLoader::singleton()->resolveResource('unclecheese/dropzone:images/file-icons'); + ModuleResourceLoader::singleton()->resolveResource('unclecheese/dropzone:images/file-icons')->getURL(); } /** From 9a9feb858556623d67939e31ae96915a44cdc5a4 Mon Sep 17 00:00:00 2001 From: UndefinedOffset Date: Wed, 4 Sep 2019 14:58:07 -0300 Subject: [PATCH 2/3] FIX: Fixed issue where the has_one relationship on FileAttachmentFieldTrack was not setup to point to the namespaced file class --- src/FileAttachmentFieldTrack.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/FileAttachmentFieldTrack.php b/src/FileAttachmentFieldTrack.php index 5894252..c032e9e 100644 --- a/src/FileAttachmentFieldTrack.php +++ b/src/FileAttachmentFieldTrack.php @@ -2,6 +2,7 @@ namespace UncleCheese\Dropzone; +use SilverStripe\Assets\File; use SilverStripe\Control\Controller; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObjectInterface; @@ -20,7 +21,7 @@ class FileAttachmentFieldTrack extends DataObject ); private static $has_one = array( - 'File' => 'File', + 'File' => File::class, ); private static $table_name = 'FileAttachmentFieldTrack'; From d4d39ebda95a6627ca96460bde20e2290a15e234 Mon Sep 17 00:00:00 2001 From: UndefinedOffset Date: Thu, 24 Sep 2020 11:46:18 -0300 Subject: [PATCH 3/3] Changed to resolve url --- src/DropzoneFile.php | 2 +- src/FileAttachmentField.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/DropzoneFile.php b/src/DropzoneFile.php index 96220a1..8eb98fd 100644 --- a/src/DropzoneFile.php +++ b/src/DropzoneFile.php @@ -83,7 +83,7 @@ public function getPreviewThumbnail($w = null, $h = null) */ protected function getFilenameForType($ext, $size) { - return ModuleResourceLoader::singleton()->resolveResource(sprintf( + return ModuleResourceLoader::singleton()->resolveURL(sprintf( 'unclecheese/dropzone:images/file-icons/%spx/%s.png', $size, strtolower($ext) diff --git a/src/FileAttachmentField.php b/src/FileAttachmentField.php index e3e8586..ddea293 100644 --- a/src/FileAttachmentField.php +++ b/src/FileAttachmentField.php @@ -1139,7 +1139,7 @@ public function AttachedFiles() public function RootThumbnailsDir() { return $this->getSetting('thumbnailsDir') ?: - ModuleResourceLoader::singleton()->resolveResource('unclecheese/dropzone:images/file-icons')->getURL(); + ModuleResourceLoader::singleton()->resolveURL('unclecheese/dropzone:images/file-icons'); } /**