Problem/Motivation
Adding an Entity Reference field with the Draggable Table widget to a multi-value Field Collection field causes erratic behavior when adding/removing entities from the node.
This is caused because there are multiple tables with the same id:
// We don't use drupal_html_id() here because our ajax callback needs
// to be able to know what the table id is. We should never have
// the same form field multiple times on a page anyway.
$table_id = drupal_clean_css_identifier('entityqueue-dragtable-' . $field_name);
There are several other assumptions that should be removed like assuming that the field is in the root of the $form
Proposed resolution
Remove the assumptions that prevent a Draggable Table widget from being used within a field collection.
Comments
Comment #1
davidwbarratt commentedComment #2
davidwbarratt commentedComment #3
jojonaloha commentedSounds like this will be necessary after #2460503: Move the "Draggable Table" Entity Reference Widget into it's own module. I wonder if this is related to #2332619: Draggable table widget conflicts with Inline Entity Form as well, the problems you describe sound like it would be problems in anything like IEF, Editableviews and others that can have multiple entity forms.
Comment #4
davidwbarratt commentedAttached is a patch that removes the single field per form assumptions. This patch is running in production without a problem.
Comment #5
davidwbarratt commentedComment #6
albertski commentedThis patch fails at entityqueue_field_widget_ajax_callback().
Comment #7
albertski commentedComment #8
amateescu commentedClosing out old issues.