You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
HasOne relation use the DBForeignKey to scaffold their field which builds a SearchableDropdownField for most DataObject. It also has a bit of hard coded logic for File.
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 matching scaffoldFormField on singleton to retrieve its form field:
DataObject::scaffoldFormField() could SearchableDropdownField as a sensible default.
File could override that default to return an UploadField which would avoid tying DBForeignKey to the File class.
Specialised DataObjects like Link can specify their own custom field.
@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.
Description
DBField can scaffold form field to manage what should be used to managed them. e.g.
silverstripe-framework/src/ORM/FieldType/DBMoney.php
Lines 184 to 188 in 4429a49
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.silverstripe-framework/src/ORM/FieldType/DBForeignKey.php
Lines 57 to 86 in 4429a49
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
The text was updated successfully, but these errors were encountered: