Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Reference dialog is not working for Entity reference Taxonomy term if term relationship (Parent term) is selected while creating new term.
Comment | File | Size | Author |
---|---|---|---|
#8 | references_dialog-2533678-8.patch | 4.87 KB | eyilmaz |
#3 | references_dialog-not-working-for-term-added-with-parent-term-2533678-3.patch | 1.26 KB | laxman.ghavte |
Comments
Comment #1
laxman.ghavte CreditAttribution: laxman.ghavte commentedComment #2
laxman.ghavte CreditAttribution: laxman.ghavte commentedComment #3
laxman.ghavte CreditAttribution: laxman.ghavte at Faichi Solutions Pvt Ltd commentedAfter 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.
Comment #4
laxman.ghavte CreditAttribution: laxman.ghavte at Faichi Solutions Pvt Ltd commentedComment #5
laxman.ghavte CreditAttribution: laxman.ghavte at Faichi Solutions Pvt Ltd commentedComment #6
makbul_khan8 CreditAttribution: makbul_khan8 at Faichi Solutions Pvt Ltd commentedCode works fine.
Comment #7
eyilmazThere 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..
Comment #8
eyilmazAdded as $_GET Parameter to the URL.
Checking entity_type on entity_insert and entity_update.
Comment #9
laxman.ghavte CreditAttribution: laxman.ghavte at Faichi Solutions Pvt Ltd commentedCode works fine.