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

davidwbarratt’s picture

Title: Using the Draggable Table widget in a Field Colleciton causes erratic behavior » Using the Draggable Table widget in a Field Collection causes erratic behavior
davidwbarratt’s picture

Issue summary: View changes
jojonaloha’s picture

Sounds 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.

davidwbarratt’s picture

StatusFileSize
new10.7 KB

Attached is a patch that removes the single field per form assumptions. This patch is running in production without a problem.

davidwbarratt’s picture

Version: 7.x-1.0-rc1 » 7.x-1.x-dev
Status: Active » Needs review
albertski’s picture

This patch fails at entityqueue_field_widget_ajax_callback().

± |7.x-1.x ✓| → curl https://www.drupal.org/files/issues/dragtable_field_collection-2482769-4.patch | patch -p1
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 10957  100 10957    0     0  25036      0 --:--:-- --:--:-- --:--:-- 25015
patching file entityqueue.module
Hunk #1 succeeded at 900 (offset -2 lines).
Hunk #2 succeeded at 911 (offset -2 lines).
Hunk #3 succeeded at 953 (offset -2 lines).
Hunk #4 succeeded at 1004 (offset -2 lines).
Hunk #5 succeeded at 1021 (offset -2 lines).
Hunk #6 succeeded at 1052 (offset -2 lines).
Hunk #10 FAILED at 1168.
1 out of 10 hunks FAILED -- saving rejects to file entityqueue.module.rej
albertski’s picture

Status: Needs review » Needs work
amateescu’s picture

Status: Needs work » Closed (outdated)

Closing out old issues.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.