Reference dialog is not working for Entity reference Taxonomy term if term relationship (Parent term) is selected while creating new term.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

laxman.ghavte’s picture

Issue summary: View changes
laxman.ghavte’s picture

Title: Reference dialog is not working for Entity reference Taxonomy term if term relationship » Reference dialog is not working for Taxonomy term added with parent term
laxman.ghavte’s picture

After saving new term with Parent term relationship, first hook_entity_insert() get triggered and then hook_entity_update(). After hook_entity_update() it looses its id and pass wrong id in $_GET['destination'].

I have fixed this issue. Please check the attached patch.

laxman.ghavte’s picture

Status: Needs work » Needs review
laxman.ghavte’s picture

Assigned: laxman.ghavte » Unassigned
makbul_khan8’s picture

Assigned: Unassigned » makbul_khan8
Status: Needs review » Reviewed & tested by the community

Code works fine.

eyilmaz’s picture

Status: Reviewed & tested by the community » Needs work

There is a problem with this patch if you create an entity via references_dialog in which you also add another entity.
With this patch, we assume, that the first created/updated entity is the entity for this dialog, which is the case for taxonomy terms with parent selection (because vocabulary is updated, if hierarchy is changed), but not for new entities with new file upload for example.
We need a function to detect or determine if the updated or created entity is the right one in hook_entity_update and hook_entity_insert..

eyilmaz’s picture

Assigned: makbul_khan8 » Unassigned
Status: Needs work » Needs review
FileSize
4.87 KB

Added as $_GET Parameter to the URL.
Checking entity_type on entity_insert and entity_update.

laxman.ghavte’s picture

Status: Needs review » Reviewed & tested by the community

Code works fine.