Needs work
Project:
Dynamic Entity Reference
Version:
4.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
14 Jul 2016 at 12:17 UTC
Updated:
31 Jan 2026 at 13:02 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
berdirBump, this would be nice. We could also add a link widget that uses it unless this gets into core?
Comment #3
jibranI started working on this locally a while back. Here is WIP patch. Feel free to pick this up.
Comment #4
sam152 commentedI built this, but a scaled down version that isn't as full featured as 'entity_autocomplete'. For example, it doesn't create entities for you and also doesn't support matching on entity titles, not selected from the AJAX dropdown. I found the core on a bit daunting and didn't want to copy a bunch of code I didn't understand into a project I had to support, so alas a heavily inspired version, with none of the features.
In a sandbox right now: https://www.drupal.org/sandbox/sam/2881047
Comment #5
jibranI can totally understand. Would you like to upload a patch here? So that we can finish this up and add to DER.
Comment #6
sam152 commentedRight now it's setup as its own module (routes, namespaces etc). I'm going to keep iterating on it in that form (as I'm loading it into another project via composer).
If at any time it looks useful enough to bring into DER, you can be my guest to do that.
Comment #7
joachim commented> Here is WIP patch. Feel free to pick this up.
Could you outline briefly what work is needed on the patch? I don't see anything marked TODO in the patch code.
Comment #8
joachim commented... ah, I do see lots of things crash with this patch though ;)
Comment #9
wim leersWhat concrete problem does this solve? Why is
\Drupal\dynamic_entity_reference\Plugin\Field\FieldWidget\DynamicEntityReferenceWidgetinadequate?Comment #10
jibranI think @Berdir said it best in #2. We want to use this element in link field widget so the user can reference any entity URI.
Comment #11
wim leersOh! So this issue is specifically about generic linking, and not about improving the widget for DER fields?
Comment #12
berdirIt's about making it a form element/plugin and generalizing the logic.
Exactly like \Drupal\Core\Entity\Element\EntityAutocomplete.
Comment #13
maxilein commentedDoes this have something to do with DER_Extra? https://www.drupal.org/sandbox/jibran/2932751
Comment #14
rp7 commentedComment #15
rp7 commentedI took a stab at this. Check the issue fork.
Next to the dynamic entity autocomplete form element, it also provides a field widget that uses this form element.
Check the attached recording.
Comment #17
jibranLet's add some tests as well.
Comment #19
tstoecklerThanks for this @rp7, this is really awesome!
For a project we needed this functionality as a link widget, so per #2 after we had implemented it, I went ahead and pushed it to this branch, I hope that's OK. Also following #15's awesome example, adding a video of the widget settings form and the widget in action.
Two notes on that for completeness sake:
entity:URLs for the given entity types