-
Notifications
You must be signed in to change notification settings - Fork 824
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
NEW: Support dot syntax in form field names #9192
Conversation
This is a companion to silverstripe/silverstripe-framework#9192 to provide the same functionality for inline editing in GridFields A valuable use of this is editing fields in the join-object of a many-many-through relation.
Making as WIP as the tests need to be fixed, new tests need to be written, and docs |
This pull request hasn't had any activity for a while. Are you going to be doing further work on it, or would you prefer to close it now? |
I'm using this code in production via composer-patches so I'm definitely keen to see it make its way into mainline. I'll endeavour to get tests added and tests passing to make it mergeworthy in the next few weeks. |
@sminnee Still keen on adding tests here? |
I've put this through its paces, wrote some unit tests, and docs with extensive code examples that I've tested manually as well. Found a few functional gaps, e.g. the ability to get the field via new FieldSet([
new TextField('My.Field'),
new TabSet('My', [
new TextField('Field'),
])
]); I think that's acceptable, and very unlikely to happen in the real world. I've also considered the security aspects of this, and can't fault it. You'll need to opt-in to this behaviour by whitelisting the relationships which are allowed to be written. There's some sensitivity about explicitly checking @emteknetnz @dhensby @sminnee Good to merge? Marginally related gotcha: Some unrelated |
This change adds support for these in a few places. - Form::saveInto($record) - Form::loadDataForm($record) - Form::loadDataForm($_POST) Fixes #9163
The functioning of dot-syntax in form fields mean that .s are more likely to appear in names. This breaks javascript behaviour in HTML IDs and I believe is an invalid character for them.
This avoids having arbitrary differences between a join object and a has-one relation.
Related to #9163
Alright got a thumbs up from a core committer (Dan), and the work is semi peer reviewed, so I'm calling this done! Just added another commit with a changelog entry to raise the visibility of the tutorial. |
This change adds support for these in a few places.
Fixes #9163
To do