Incompatibility with embedded form via #ajax
Step to reproduce (without coding..)
- Create a custom content type 'table', with a tablefield field.
- download and install the module http://drupal.org/project/inline_entity_form OR https://www.drupal.org/project/entityreference
- Create a second content type 'page' with an entity reference to the content type 'table'
- use inline entity form field widget for the entity reference.
- create a new node "page", create inside the widget your referenced node "table"
- save
- edit the node page, edit the node "table" inside the widget
- Default values are missing in the widget but are in database.
A test in widget_form() assert that the default values will be loaded from the entity object only if the form doesn't have in form_state any clicked button values.
The solution is to test only against named button if clicked button value are present.
Comment | File | Size | Author |
---|---|---|---|
#9 | tablefield-refactor_widget_form-2615188-2493563-1673416.patch | 6.88 KB | vitalie |
#5 | tablefield-change-without-saving-in-entity-reference-2493563-5-D7.patch | 1.37 KB | boesbo |
Comments
Comment #1
delta CreditAttribution: delta commentedComment #2
delta CreditAttribution: delta at Studio.gd for Studio.gd commentedComment #3
vitalie CreditAttribution: vitalie commentedthx @delta. I could reproduce this and the patch fixes the issue, however it introduces a regression bug as described here: #1673416: Image upload interferes with Rebuild table
Comment #4
delta CreditAttribution: delta at Studio.gd for Studio.gd commentedOk i need to try the step in #1673416 against the patch in this issue.
Comment #5
boesbo CreditAttribution: boesbo as a volunteer commentedTablefield has issues with entity_reference. With the patch I fixed:
- edit a node with an entity reference field and with the referenced node with tablefield.
Comment #6
boesbo CreditAttribution: boesbo as a volunteer commentedComment #7
mrkprod CreditAttribution: mrkprod commentedThis patch works for me... for empty edit of existing tables loaded in ajax..
Thanks!
Comment #8
johnny5th CreditAttribution: johnny5th at Encore Multimedia commentedThis patch works for me, but for latest dev, the first hunk fails (it's just an empty line deletion)
Comment #9
vitalie CreditAttribution: vitalie commentedThank you @BOESbo for #5. The patch, but also Issue #2615188: Data loss when multiple tablefields are attached via Paragraph bundles, shows that the code in the widget_form functions is getting a bit heavy, so I had a go at refactoring a bit. I think it's better now. But needs testing again.
@johnny5th, it should apply cleanly to latest dev.
Comment #11
vitalie CreditAttribution: vitalie commented