Update: When more than one ER field is set to use Drag & Drop widget, all changes to the node are saved except any values within "Additional Options" vertical tab (published, promoted, sticky, etc). This happens on stable and dev versions of the module, and tested on a clean installation.
When multiple ER fields are set to use Drag & Drop widget, any changes are saved, but the content is set to unpublished. This appears to happen with both stable and dev versions. I've tested on two installations, both 7.38.
- Create a new content type
- Add two entity reference fields (anything will do, user, node)
- Set only one of the entity reference fields to Drag & Drop widget, leave other as Select.
- Create a node using that test content type, no ER selection is necessary for the test.
- Ensure "Published" is set
- Save content
-- [content is saved as expected, content is published]
- Set the second ER field to use Drag & Drop widget, making both ER fields using Drag & Drop widget
- Edit the content
- Ensure "Published" is still set
- Save content.
-- [content was saved, but has been unpublished]
I thought this might be a max_input_vars issue, but it appears that's not the case.
Comments
Comment #1
spelcheck commentedI checked the values of the submitted $form_state using hook_node_submit() and found that many $form_state['input'] values were NULL when two Drag & Drop widgets were used in the same form, namely status, promoted and a few others. Only when not more than one ER field was set to use Drag & Drop widget would it populate those values. This explains why the node is set to unpublished.. the status, promoted and other values are wiped when multiple D&D widgets are used.
Comment #2
spelcheck commentedReferring to an issue with a separate module (though still form related) https://www.drupal.org/node/1848122 is an issue with Multistep Nodeform with the title "Some form field values don't persist across steps". #5 one of the maintainers bullet points the known bugs they are working on fixing, one of them being "some checkboxes in vertical tabs "Additional information" [values don't persist]"
On a hunch, I thought maybe if I can get those "Additional Options" i.e. promoted, status, etc checkboxes out of the vertical tabs, maybe it would make a difference with this issue. I found this sandbox project on github takes all of those vertical tabs and places them into fieldsets. https://gist.github.com/joshuapowell/1680568
This solves the problem. I believe at this point the bug in Entity Reference Drag & Drop lies in how the form is being built when multiple ER D&D widgets are used. I'll post what I find, after comparing dpm a bit further up the line. For reference: https://www.drupal.org/node/165104
Comment #3
spelcheck commentedComment #4
spelcheck commentedYikes, such an easy solution. If only I had taken a look at the dom from the start haha. Even worth a patch?
Line 48: entityreference_dragdrop.module
Comment #6
sergei_brill commentedComment #7
sergei_brill commented