1

Is there a way to display a multi-value entity reference field as a draggable widget in a node edit form? I'm looking for the exact same behavior that a multi-value image field has by default. I would like a way for the content editor to easily reorder the referenced entities after they have been added via an autocomplete field. I really thought this was core functionality.

Thanks for your help.

I have found this module, but the UI is pretty bad and I really want the same UI that an image field has. https://www.drupal.org/project/entityreference_dragdrop

1 Answer 1

3

You can get the multiple values input in a table format with the draggable option if you choose Autocomplete widget for that field under Manage form display for that Content type (not the Autocomplete (Tags style)).

If your field accepts an unlimited number of values the widget will present as one autocomplete input field with a button to Add another item. As you add more items you will be able to drag and drop to rearrange the values order.

entity Reference Autocomplete widget Unlimited values

You can also get that reordering widget with Inline entity form widget (with the additional module Inline entity form).

4
  • Wow, thank you! My field was actually limited to 1 item and I thought I had set it to unlimited. It was core functionality! (face palm) Commented Apr 15, 2019 at 3:58
  • It happens sometimes :) I almost dismantled my computer once because the sound wasn't working thinking it must be the sound card, when in fact the speakers weren't plugged in :D
    – prkos
    Commented Apr 15, 2019 at 17:57
  • Is it still possible to (re)order items with the inline entity form widget? As far as I can see, there is no configuration option for that.
    – dercheffe
    Commented May 24, 2020 at 15:50
  • You can reorder within the inline entity widget when adding more than one existing entities. I'm not sure about creating new ones, they don't seem to be rendered within a draggable table.
    – prkos
    Commented May 24, 2020 at 16:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.