Skip to content
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 SiteTree form field scaffolding #550

Merged

Conversation

GuySartorelli
Copy link
Member

Also updates best practices around scaffolding form fields.

Issue

scaffold_cmsfields_settings:
restrictRelations:
- 'EmailRecipients'
```
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This yaml snippet is pretty long - if you want I can put it inside a collapsed <details> block.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah collapsible would be good.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

scaffold_cmsfields_settings:
restrictRelations:
- 'EmailRecipients'
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah collapsible would be good.


[`SiteTree::getCMSFields()`](api:SilverStripe\CMS\Model\SiteTree::getCMSFields()) used to create its form fields from scratch, without calling `parent::getCMSFields()`. This meant that all subclasses of `SiteTree` (i.e. all of your `Page` classes) had to explicitly define all form fields.

`SiteTree::getCMSFields()` now uses same form field scaffolding that all other `DataObject` subclasses use.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`SiteTree::getCMSFields()` now uses same form field scaffolding that all other `DataObject` subclasses use.
`SiteTree::getCMSFields()` now uses the same form field scaffolding that all other `DataObject` subclasses use.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Also updates best practices around scaffolding form fields.
@GuySartorelli GuySartorelli force-pushed the pulls/6/scaffolded-sitetree branch from 4ceb0b2 to f019154 Compare August 14, 2024 03:09
@emteknetnz emteknetnz merged commit 097a664 into silverstripe:6 Aug 15, 2024
3 checks passed
@emteknetnz emteknetnz deleted the pulls/6/scaffolded-sitetree branch August 15, 2024 01:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants