- Issue created by @larowlan
- πΊπΈ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!
- π¨πSwitzerland dpacassi ZΓΌrich, Switzerland
Played around a bit more, I think there are two points that we haven't thought of.
1. Content types already limited by the field settings
If I add an entity reference field and limit it to e.g. nodes of type "article" in the field settings but use the new LinkIt widget, that widget will return a list of nodes with the filters set on the linkit profile.
I think that's slightly wrong as I'd say the field settings limitations are more important than the linkit profile settings.
My proposal would be to simply combine both filters? Like use the LinkIt profile filters and then apply the field setting filters additionally.2. Searchable metadata
Displaying the metadata is already great but it would be even better if that data is also searchable?
If the widget displays the username in the metadata, we could search for an username instead of the title and the widget would return the entities. Fancy, right?
However, we probably want to add an option to the form display settings to set if we want to search the metadata data as well.Would love to help out but December is quite busy for me as probably for most of us but still wanted to point out to these two points.