Closed maxime-rainville closed 1 month ago
Is this a duplicate of https://github.com/silverstripe/silverstripe-framework/issues/11079?
@maxime-rainville If this is the same as #11079 (and I'm 90% sure it is), it can be done in a minor release - in fact that issue is in the 5.3 milestone already.
Closed as duplicate.
Description
DBField can scaffold form field to manage what should be used to managed them. e.g. https://github.com/silverstripe/silverstripe-framework/blob/4429a4999dfd1fdfb29a3b910519c389ae8749d7/src/ORM/FieldType/DBMoney.php#L184-L188
HasOne
relation use theDBForeignKey
to scaffold their field which builds aSearchableDropdownField
for most DataObject. It also has a bit of hard coded logic for File.https://github.com/silverstripe/silverstripe-framework/blob/4429a4999dfd1fdfb29a3b910519c389ae8749d7/src/ORM/FieldType/DBForeignKey.php#L57-L86
They are many scenarios where
SearchableDropdownField
is not the best form field to use for a specific DataObject. e.g.: Link, SiteTree, Taxanomie Tags.I'm thinking it would be trivial to update
DBForeignKey::scaffoldFormField()
to call a matchingscaffoldFormField
on singleton to retrieve its form field:DataObject::scaffoldFormField()
couldSearchableDropdownField
as a sensible default.File
could override that default to return an UploadField which would avoid tying DBForeignKey to the File class.Additional context or points of discussion
Related issues