Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

jibran created an issue. See original summary.

berdir’s picture

Bump, this would be nice. We could also add a link widget that uses it unless this gets into core?

jibran’s picture

StatusFileSize
new28.16 KB

I started working on this locally a while back. Here is WIP patch. Feel free to pick this up.

sam152’s picture

I 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

jibran’s picture

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.

I can totally understand. Would you like to upload a patch here? So that we can finish this up and add to DER.

sam152’s picture

Right 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.

joachim’s picture

> 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.

joachim’s picture

... ah, I do see lots of things crash with this patch though ;)

wim leers’s picture

What concrete problem does this solve? Why is \Drupal\dynamic_entity_reference\Plugin\Field\FieldWidget\DynamicEntityReferenceWidget inadequate?

jibran’s picture

I 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.

wim leers’s picture

Oh! So this issue is specifically about generic linking, and not about improving the widget for DER fields?

berdir’s picture

It's about making it a form element/plugin and generalizing the logic.

Exactly like \Drupal\Core\Entity\Element\EntityAutocomplete.

maxilein’s picture

Does this have something to do with DER_Extra? https://www.drupal.org/sandbox/jibran/2932751

rp7’s picture

Version: 8.x-1.x-dev » 4.x-dev
rp7’s picture

I 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.

jibran’s picture

Status: Active » Needs work
Issue tags: +Needs tests

Let's add some tests as well.

tstoeckler made their first commit to this issue’s fork.

tstoeckler’s picture

Thanks 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:

  1. After recording the widget settings form I went back and enabled all bundles for media and node in order to get the most results in the second video
  2. I did verify that submitting the form does correctly store entity: URLs for the given entity types