-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DOC Document scaffolding formfields for model relations #527
DOC Document scaffolding formfields for model relations #527
Conversation
@@ -83,6 +83,91 @@ You can also alter the fields of built-in and module `DataObject` classes by imp | |||
> [!NOTE] | |||
> `FormField` scaffolding takes [`$field_labels` config](#field-labels) into account as well. | |||
|
|||
## Scaffolding for relations | |||
|
|||
Form fields are also automatically scaffolded for `has_one`, `has_many`, and `many_many` relations. These have sensible default implementations, but you can customise what form field will be used for any given `DataObject` model. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Form fields are also automatically scaffolded for `has_one`, `has_many`, and `many_many` relations. These have sensible default implementations, but you can customise what form field will be used for any given `DataObject` model. | |
Form fields are also automatically scaffolded for `has_one`, `has_many`, and `many_many` relations. These have sensible default implementations, and you can also customise what form field will be used for any given `DataObject` model. |
"but" kind of negates what is said before it, though sensible defaults and not something to negate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Form fields are also automatically scaffolded for `has_one`, `has_many`, and `many_many` relations. These have sensible default implementations, but you can customise what form field will be used for any given `DataObject` model. | ||
|
||
> [!NOTE] | ||
> Polymorphic `has_one` relations do not have scaffolded form fields. Usually these are managed via a `has_many` relation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
> Polymorphic `has_one` relations do not have scaffolded form fields. Usually these are managed via a `has_many` relation. | |
> Polymorphic `has_one` relations do not have scaffolded form fields. Usually these are managed via a `has_many` relation on the other side of the relation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What side is "the other side"? I think this makes it more confusing rather than clearer.
I'll try "which points at the has_one
relation" instead and see what you think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opps meant to request changes
f5767a5
to
22490ba
Compare
@@ -83,6 +83,91 @@ You can also alter the fields of built-in and module `DataObject` classes by imp | |||
> [!NOTE] | |||
> `FormField` scaffolding takes [`$field_labels` config](#field-labels) into account as well. | |||
|
|||
## Scaffolding for relations | |||
|
|||
Form fields are also automatically scaffolded for `has_one`, `has_many`, and `many_many` relations. These have sensible default implementations, and you can also customise what form field will be used for any given `DataObject` model. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Form fields are also automatically scaffolded for `has_one`, `has_many`, and `many_many` relations. These have sensible default implementations, and you can also customise what form field will be used for any given `DataObject` model. | |
Form fields are also automatically scaffolded for `has_one`, `has_many`, and `many_many` relations on the form created when editing DataObjects, with the notable exception of the [SiteTree](api:SilverStripe\CMS\Model\SiteTree) edit form. These have sensible default implementations, and you can also customise what form field will be used for any given `DataObject` model. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've put it in the section above this instead, since that isn't something unique to fields scaffolded for relations.
22490ba
to
d2f3867
Compare
Issue
DataObject
subclass to define its own formfield when autoscaffolded from relation silverstripe-framework#11079