I was thinking of the ability to add an option to bind view mode select field with a form mode of the paragraph.
If the form mode with the same id will exist, then the paragraph form will be replaced with this specific form mode.
There are a few challenges here... First is to replace the paragraph form dynamically via ajax. I was looking into Paragraphs module source code and seems like it might be cumbersome to accomplish such functionality. At least I wasn't able to see an easy way at a first glance.
The second thing is that I hope that all the form values will be preserved. I would like to avoid such cases when changing the view mode value wipes all the paragraph values.
I don't have enough time to implement such a feature, so that's why I'm opening this issue for a community. Any help with that will be appreciated.
Comments
Comment #2
JFKiwad+1
Comment #3
sayco commentedComment #4
sayco commentedComment #5
simeI like this approach because it would open up the ability to do nice things like control the form in twig, I think?
My experience with this type of functionality is using form #states to attach visible/required events based on the view mode selector. But this had bad DX, and when bugs occur in core it's a bit frustrating.
Comment #6
simeComment #7
sayco commentedI have some progress on this issue. I hope I'll be able to push something to dev within a few weeks.
Comment #10
sayco commentedFinally, I've managed to make it work! The latest changes have been pushed to the dev branch. Hope some of the sites will start using it and we will receive a valuable feedback
Comment #11
sayco commentedComment #13
renatog commentedGreat, thank you
Comment #14
renatog commentedCreated this task to update the hook_help with this information