Message of the day:
Release 4.5.0 is out. Changelog: https://docs.silverstripe.org/en/4/changelogs/4.5.0
SilverStripe 4 related information and questions.
I am guessing
asset-admin is doing something clever to overwrite this
Although it looks like
DBFile::scaffoldFormField() returns null
@Conan looks like you should be hitting this line: https://github.com/silverstripe/silverstripe-framework/blob/4/src/Forms/FormScaffolder.php#L125
$fieldClass set? Maybe there is a config setting or something that could globally change this?
@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
$hasOneField = new $fieldClass($fieldName); unlucky 😐
@Conan that is what I would do
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 🤔
@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.
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?!!