-
Notifications
You must be signed in to change notification settings - Fork 824
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Allow each DataObject
subclass to define its own formfield when autoscaffolded from relation
#11079
Comments
This would be a marvelous addition to the DataObject infrastructure 💯 |
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
silverstripe-framework/src/ORM/FieldType/DBForeignKey.php Lines 57 to 86 in 4429a49
They are many scenarios where I'm thinking it would be trivial to update
Related issues |
Linked PRs have been merged |
Currently, we have the following hard-coded logic for autoscaffolding relations:
has_one
relations are autoscaffolded as one of:DropdownField
if there's less than a configurable thresholdNumericField
if there's more than a configurable thresholdFileHandleField
(usuallyUploadField
) if it's a file or imagehas_many
andmany_many
relations are autoscaffolded asGridField
fields inside a tab.Some models have specific form fields they should be used with. For example, a
Link
model might have a specificLinkField
forhas_one
andMultiLinkField
forhas_many
relations.Currently, adding the form fields for these models often requires first removing the original autoscaffolded field. It would be way better if it just autoscaffolded the correct field from the start.
We should allow each model to instantiate its own form field when being autoscaffolded from a relation.
Acceptance criteria
File
is updated to auto-scaffold UploadField for has_one relationsPRs
The text was updated successfully, but these errors were encountered: