Great module,. however I cannot for the life of me get it to work.

Everything works great up to the point of saving a new user, and then the entity reference field shows Client(94) instead of Test Test(3859), not sure where the Client or random UID is coming from but saving the node then fails as the refernced user is invalid (doesnt exist.)

Has anyone else seen this behaviour?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

adevms’s picture

I have the same situation.
It's because there's another entity attached to the user entity, in my case it's a Profile2 entity. After saving a new user the references_dialog_entity_insert() gets called twice, once for the user entity and once for the Profile2 entity.
Because of this the destination parameter gets rewritten with the new profile entity's id and the entity reference field get's filled with the Profile type and new profile id.
Checking if the destination parameter is set, solves the problem. I'm attaching a patch.

haydeniv’s picture

Status: Active » Needs review

When there is a patch an issue should have the status Needs review so the maintainer knows that there is code to review.

sebkamil’s picture

@adevms your patch doesn't seem to change anything. Could you explain how you fixed this? Thanks

I have a similar issue where I am adding videos as Assets. When they are transcoded though, the Reference Dialog references the file rather than the Asset.

edit - Nevermind. I applied the path wrong. It doesn't fix my problem though. Will post an update once I get it fixed.

sebkamil’s picture

Status: Needs review » Needs work
SpaghettiBolognese’s picture

Status: Needs work » Needs review
FileSize
1.27 KB

Both patches did not fix the full for me so I updated the patch from #1. Works for both adding and updating entities.

scalas89’s picture

Just cleaned the patch to let it work with drush make.

foagth’s picture

Patch #7 also works for entity references to a type having a workflow field.
If not patched, the entity reference field takes the workflow's id e.g. Workflow State (444)

majusz’s picture

Had the same problem, not with a user, but with a node on an Entity reference field.

Patch #7 works for me, too. Thanks very much!