Add a widget for entity-reference fields

Created on 4 November 2024, 19 days ago

Problem/motivation

The UX of linkit suggestions is real nice 🀩
So nice that clients would like something similar for entity-reference fields.

Proposed resolution

Add an entity reference widget that makes use of linkit matchers/suggesters.

✨ Feature request
Status

Active

Version

6.1

Component

Code

Created by

πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @larowlan
  • πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10
  • Merge request !82Add entity reference widget β†’ (Open) created by larowlan
  • Pipeline finished with Failed
    19 days ago
    Total: 138s
    #328692
  • πŸ‡ΊπŸ‡ΈUnited States mark_fullmer Tucson

    Assigning to myself for review...

  • πŸ‡ΊπŸ‡ΈUnited States mark_fullmer Tucson

    This works great functionally! I'm just seeing a series of errors when I run tests locally. The first, as shown in the previous major test pipeline in https://git.drupalcode.org/project/linkit/-/jobs/3267712, fails because the form element description is not visible:

    1) Drupal\Tests\linkit\FunctionalJavascript\LinkEntityReferenceFieldTest::testLinkEntityReferenceWidget
    Behat\Mink\Exception\ElementHtmlException: The string "Start typing to find content or paste a URL and click on the suggestion below." was not found in the HTML of the element matching css "#edit-field-test-er-wrapper".
    

    I'm not sure that the description text "Start typing to find content or paste a URL and click on the suggestion below." is quite right for a generic entity reference field, and I think we could just leave the form element description blank and have the site builder supply appropriate help text. But even with removing that, the tests fail on subsequent checks, such as the following:

    1) Drupal\Tests\linkit\FunctionalJavascript\LinkEntityReferenceFieldTest::testLinkEntityReferenceWidget
    Behat\Mink\Exception\ElementNotFoundException: Element matching css "li.linkit-result-line .linkit-result-line--description" not found.
    

    I replayed this code change on the 7.x branch, which provides Drupal 11 compatibility. Ideally, we merge to that (but can also merge to 6.1.x). Will need to return to this to understand why the tests are failing as described above. Setting to "Needs work."

  • πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10

    Thanks mate, I'll work on those fixes over the coming days/week

  • πŸ‡¨πŸ‡­Switzerland dpacassi ZΓΌrich, Switzerland

    Wow, this would be *really* amazing, I was just googling for solutions and came across https://www.drupal.org/project/linkit_references β†’ (but that's for D7), so having this in LinkIt core would be so great!

Production build 0.71.5 2024