Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
How to react on entity translation insert/update/delete?
Is there a plan to implement a hook_entity_translation_insert()
, hook_entity_translation_update()
, hook_entity_translation_delete()
?
Comment | File | Size | Author |
---|---|---|---|
#16 | et-hooks-1224590-16.patch | 11.68 KB | plach |
#15 | et-hooks-1224590-15.patch | 11.68 KB | plach |
#12 | et-hooks-1224590-12.patch | 9.24 KB | plach |
#12 | et-hooks-1224590-12.test.patch | 5.59 KB | plach |
#9 | et-crud-hooks-1224590-9.patch | 3.1 KB | bforchhammer |
Comments
Comment #1
plachGood point, this seems a sensible request: no plan atm, but this should not be hard to implement. Patches welcome.
Comment #2
plachComment #3
plachRepurposing. See #1624830: Plan for Entity Translation 7.x-1.0 release.
Comment #4
bforchhammer CreditAttribution: bforchhammer commentedI just had a quick look at this, and I'm wondering whether hooks should be called when the handler object is updated (i.e. setTranslation, removeTranslation methods), or before/after data is actually stored in the database (i.e. saveTranslations method)... Thoughts?
Comment #5
plachFrom the top of my head I'd say after the values are stored, but I did not have the chance to wrap my mind around this yet.
Comment #6
bforchhammer CreditAttribution: bforchhammer commentedAttached is a quick first stab at a patch... probably needs work.
Comment #7
bforchhammer CreditAttribution: bforchhammer commentedSame as #6 with less errors in docs.
Comment #8
plachThanks, seems like a good start!
What about passing entity and entity type instead of the handler? This would look more consistent with the core entity hooks and the handler could be retrieved by using those two if needed.
Comment #9
bforchhammer CreditAttribution: bforchhammer commentedYes, I also just realized that entity-related info was kind-of missing ;-)
Comment #10
plachAwesome, thanks.
Feel free to commit #9.
Comment #11
bforchhammer CreditAttribution: bforchhammer commentedThanks. Committed & pushed :)
Comment #12
plachI just realized hooks are fired before translation are stored. This is not consistent with the entity CRUD hooks. Here's a patch + tests to fix this.
Comment #14
plachComment #15
plachImproved tests.
Comment #16
plachFixed this development leftover. This looks good to go now, I will commit it soon. Reviews welcome meanwhile.
Comment #17
plachCommitted and pushed.