silverstripe-asset-admin
silverstripe-asset-admin copied to clipboard
getMinimalistObjectFromData removed the "url" field
Would it be possible to add it back ?
it was removed here https://github.com/silverstripe/silverstripe-asset-admin/commit/bbe7c660cf40d4c942eaf6e76755eeaf46c63471
I was relying on that to make clickable thumbnails (if you click on the icon, it opens directly the file, without having to open the file manager modal). I don't see a good reason to NOT expose that information.
or add an extension point that would work for me as well (would even be better actually)
as a side note, injecting a custom instance of AssetAdmin like this
SilverStripe\Core\Injector\Injector:
SilverStripe\AssetAdmin\Controller\AssetAdmin:
class: LeKoala\Base\Admin\BaseAssetAdmin
Fails as well as it gives this js error
bundle.js?m=1624034376:1 Uncaught TypeError: Cannot read property 'url' of undefined
which points to
var e = s.default.getSection("SilverStripe\\AssetAdmin\\Controller\\AssetAdmin");
l.default.add({
path: "/",
routes: [{
--> path: "/" + e.url + "/show/:folderId/:viewAction/:fileId",
component: u.default
}, {
I expect it's because the class name is hardcoded there?
In the meantime, this can be fixed by replacing the UploadField instance and adjust the getEncodedItems but still i'm a bit sad to discover this issue after upgrading to the new version
Can you use getObjectFromData?
@michalkleiner sure ! but it's not what is used by the UploadField by default.
https://github.com/silverstripe/silverstripe-asset-admin/blob/96b13878164ba6e25f449df7eb04f1aa61dea3f4/code/Forms/UploadField.php#L215
so i have to replace the uploadfield instance with a custom one that use getObjectFromData. So indeed, either we add back the url to getMinimalistObjectFromData (just reading the plain url should not be a big burden) or update the UploadField.