- Issue created by @SirClickALot
- 🇬🇧United Kingdom SirClickALot Somerset
I don't know if this is 'right' and I'd like to keep this issue open for advise from others bit in the meantime, we have been able to use a neat 'trick' to populate a node edit form with Long text (CKEDitor) the fields.
We fire up a node edit form and pick up URL query string using a token:
[current-page:query:original_question_id]
For example, firing up a new node form linked to an original...
/node/add/long_answer_response?original_question_id=8724
We process query string using an
ECA Build form
event.We also use an ECA
Insert content entity
event to copy various field's contents from the original to the target node.The real trick is in the steps labelled (1) and (2) where we force a node save in the Build form event which then triggers the second event to populate the fields and then we do a sneaky redirection back to the node form and everything is magically all there in place.
Here is an illustration of the logic if helps anyone else out...
- 🇩🇪Germany jurgenhaas Gottmadingen
I'm refusing to review processing issues in screenshots, it's just not telling enough detail of what's going on.
But I can tell that CKEditor widgets are not playing nice with anything in Drupal. Doing a save in a form build and then redirecting sounds terrible. But maybe you can use the Prepare content entity form event, and instead of trying to modify the form field, you can set field values of the entity token. Drupal will build the form afterwards and then use the values from the entity which will have been altered at that point. So, this should then use your injected values in the to be built form and all should be fine.
- 🇬🇧United Kingdom SirClickALot Somerset
OK, very interesting
...Doing a save in a form build and then redirecting sounds terrible.
... is exactly what we after because it was either nifty and smart idea or the not as it seems!
It was the voice of experience we were looking for ;-)
We did have an initial go with the Prepare content entity form but were no sure if that was the right approach, but now we'll venture forth.
- 🇩🇪Germany jurgenhaas Gottmadingen
OK, let's keep this open so that you can feed back if it actually works for you as expected. You can then mark it as fixed.