Mo

I am guessing asset-admin is doing something clever to overwrite this

Mo

Although it looks like DBFile::scaffoldFormField() returns null

Mo

@Conan looks like you should be hitting this line: https://github.com/silverstripe/silverstripe-framework/blob/4/src/Forms/FormScaffolder.php#L125

Show 1 attachment(s)
GitHub  
silverstripe/silverstripe-framework

SilverStripe Framework, the MVC framework that powers SilverStripe CMS - silverstripe/silverstripe-framework

Hide attachment content
Mo

How is $fieldClass set? Maybe there is a config setting or something that could globally change this?

Conan

@Mo Yea this seems to work alright, however I can't seem to override the default scaffolded UploadFields, but if I have done UploadField::create(..) in my data objects' getCMSFields then they get the new CustomUploadField form field. It would be nice to force all data objects which have a has_one => Image::class || File::class to use this new upload field by default. But I don't have so many data objects, so I can survive without that 😄 Update: the default form scaffolder does not create form fields using ::create() it uses new -> $hasOneField = new $fieldClass($fieldName); unlucky 😐

Conan

Hmm I need to increase the php max memory limit before a file is uploaded through the CMS UploadField, does anyone here know about any hooks I can use which are called before the actual upload process occur?

One solution I can think of is creating a custom UploadField class which extends UploadField and then tell the Injector to always use the custom class. In the custom class I could then override the upload method and set the new php max memory limit there, before the upload process begins.. is there a more clean solution though 🤔

nightjarnz

@mike_henden this is normal - as with git clone if the (optional) argument to give a name to the project is omitted (composer create-project from/package $PROJECT_NAME) then it'll use the one from the name of the package it's using to create the project with.

✔️ (1)
mike_henden

Had an odd thing happen yesterday — I was starting build on new site so I ran the Silverstripe Installer:

composer create-project silverstripe/installer

… pointing at a directory I had already set up. After configuration I noticed that the URL on my dev site looked a bit odd. So I checked the files and found my configured site was inside a folder called installer??

Never seen this before?!!