When trying to quick edit an entity reference field that uses the Drupal\entity_browser\Plugin\FieldFieldWidget\EntityReference plugin for its widget, I've run into two issues:

  1. #2635712: Cannot use Quick Edit to delete an image : that one will need to be fixed in core. That being said, the patch there fixes the logic exception, which allows us to move forward here.
  2. Quick Edit only shows its "Save" button when it detects that something was changed by the user. The change to the hidden input used by the widget isn't perceived as a change, and thus doesn't let Quick Edit knows that something changed and needs to be saved. This will need a fix in Entity Browser

I've a patch for the second bullet point, going to upload it as soon as I've got an issue number.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

DeFr created an issue. See original summary.

DeFr’s picture

Status: Active » Needs review
StatusFileSize
new328 bytes

Patch mentionned above.

Not sure yet if entity_form needs the same fix, just thought about it when uploading the patch. Testing.

slashrsm’s picture

Status: Needs review » Needs work

Tested and confirmed that it displays "Save" button when appropriate. However, it seems that something is still broken; no matter which operation I do the list of entities in the widget stays the same. When I save it respected the change (added an entity to the list).

Did you also experience that?

samuel.mortenson’s picture

Status: Needs work » Needs review

I did @slashrsm :-)

This patch should trigger the formUpdated event on selection, re-order, remove, and edit events. We could write test coverage for this, but Quick Edit test coverage is really complicated so I'm not sure if it would be worth our time. The functionality of the field widget is tested elsewhere.

samuel.mortenson’s picture

StatusFileSize
new1.47 KB
new1.06 KB
samuel.mortenson’s picture

StatusFileSize
new1.48 KB
new568 bytes

Drupal's core AJAX was preventing the click event, so I went with mousedown instead.

samuel.mortenson’s picture

Issue tags: +Nashville2018
phenaproxima’s picture

Issue tags: +Needs manual testing

The code looks pretty good to me. Normally I'd ask for tests, but @samuel.mortenson informs me that Quick Edit itself has no test coverage, and that therefore we can't add tests. That's a Mobius strip argument if I ever heard one ;)

But, tagging for manual testing.

Status: Needs review » Needs work

The last submitted patch, 6: entity-browser-quickedit-2733605-6.patch, failed testing. View results

phenaproxima’s picture

Issue tags: +Needs reroll

Ah well.

phenaproxima’s picture

StatusFileSize
new1.54 KB
new4.3 MB

I rerolled the patch, but unfortunately this is not fixed for me with 8.6.x HEAD of core and the 8.x-1.x HEAD of Entity Browser.

I set up the most bare-bones Entity Browser setup I could (just added an Entity browser display to the content view), and got this when I tried to Quick Edit a node and remove a referenced article (see attached video).

rpayanm’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
benstallings’s picture

Status: Needs review » Reviewed & tested by the community

Claude Code says:

One concern with the entity_reference.js changes:

The patch changes the selector from .entities-list.sortable to just .entities-list, and switches from the Sortable library to jQuery UI .sortable(). The current codebase (on 8.x-2.x) uses the Sortable library (line 19), not jQuery UI. This patch appears to be based on an older version of the file. It would conflict with the current code and would need to be adapted to work with the Sortable library's onEnd callback instead.

Verdict: The formUpdated trigger is the right fix — entity browser changes should participate in Drupal's unsaved-changes tracking. The common.js change applies cleanly. The entity_reference.js changes need to be rebased against the current Sortable-based code.

benstallings’s picture

Status: Reviewed & tested by the community » Closed (outdated)

Disregard my erroneous MR. The patch #11 no longer applies.

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.