ux
ux copied to clipboard
Add Collection component as form type extension
Q | A |
---|---|
Bug fix? | no |
New feature? | yes |
Tickets | Fix #... |
License | MIT |
This is based on discussion in #397, #398 and #90.
It targets to combine all discussion points from this pull requests:
- [x] Plug & Play Functionality like in #398
- [x] Avoid using of a
[data-prototype]
selector (issue in #397) - [x] Avoid wrapping or usage of custom form type (issue in #398)
- [x] Add support for nested collection with same prototype_name (regex by @dunglas form #398)
- [x] Render Add and Remove Button using Form Theme Buttons (#397, #90)
- [x] Allow option for it to control (#397, #90)
TODO
- [ ] Tests
- [ ] Docs
- [ ] Discuss open TODOs
Requirements for a Collection Form Type
After having a chat with @weaverryan today (2022-08-04) I want to add some comments from the chat here so they are not lost in Slack, about the requirements:
-
[ ] A) Clear way to be able to customize the “entry” (this is a Symfony thing, but still good to show it in examples), add button & remove button, including their positioning. This doesn’t necessarily need to be “super easy” or “automatic”. As long as it is “reasonable” and well-documented, then I’m happy. Currently achieved in the theming. I need to make it updated to the latest version.
-
[ ] B) Adding more buttons to a “toolbar” like “Cut & Copy” or “Paste” is interesting… though it seems pretty custom. This should either (1) be included in UX at some point or (2) at the very least, this should be reasonably possible for a user to add by extending UX. In other words, UX should at least allow for this possibility.
-
[ ] C) For having an “add” button on each “row”, I’ve never thought about this, but that would be a great thing to support.
-
[ ] D) Sortable: I think this is requested with a decent frequency. This would be interesting to support in the future.
A is the most important thing and B, C, D are interesting feature which should keep in mind to be able to support in userland or in our own code in the future.
Hi there, I don't want to disturb your work on this but I'm very interested to see this come to life. I've been trying to build it myself since before the UX initiative was announced although it definitely isn't finished. You can check out my code here but you're unlikely to get any new insights from it haha. Thanks :)
Some controller method ideas:
- deleteEntry (private)
- deleteAll (public)
- get entries (public?)
- deleteAtIndex (public)
- entryAtIndex (public)