Problem/Motivation

Our entity reference field widget comes with reordering functionality. When the carnality of the field is 1 this does't really make sense. It also introduces strange UX situations.

Proposed resolution

Only enable ordering for multi-value fields.

CommentFileSizeAuthor
#2 2897232_2.patch2.04 KBslashrsm
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

slashrsm created an issue. See original summary.

slashrsm’s picture

Status: Active » Needs review
FileSize
2.04 KB
miro_dietiker’s picture

Looks cool.

The only thing i noticed is that this JS code snippet has no .once protection. But dunno if there is real risk that behaviors could be triggered twice? Anyway a different issue.

slashrsm’s picture

+++ b/js/entity_browser.entity_reference.js
@@ -15,7 +15,7 @@
       $(context).find('.field--widget-entity-browser-entity-reference').each(function () {
-        $(this).find('.entities-list').sortable({
+        $(this).find('.entities-list.sortable').sortable({

I don't think that we need .once() since we're limiting the operation on context, which makes sure it only gets applied to elements that are being added to the page.

slashrsm’s picture

Status: Needs review » Fixed

Committed.

  • slashrsm committed 3217ba3 on 8.x-1.x
    Issue #2897232 by slashrsm, miro_dietiker: Only enable ordering of items...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.