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.
Over at #1340984: UUID support, a second call to hook_entity_presave()
was introduced. I'm not sure if this was intentional or not. I'm seeing this extra hook breaking integration with the title module, since the first call properly sets the title field, while the second call resets it. I can patch title module if that's where the issue should be fixed, but thought I'd inquire here first to see if this was a simple mistake.
Comment | File | Size | Author |
---|---|---|---|
#3 | double_call_to-2098041-3.patch | 917 bytes | alcroito |
Comments
Comment #1
jagilpe CreditAttribution: jagilpe commentedIs there any update to this issue? We have a problem with the title translation of fieldable panels panes, and the only logical solution that we've found is to remove one of the hook_entity_presave calls, but we would like to know if there is a reason to call this hook twice, to be sure that it's safe to remove one.
Comment #2
alcroito CreditAttribution: alcroito commentedI've investigated the code in other entity modules to see whether any-one else invokes the 'entity_presave' hook twice, and that does not seem the case.
The only reason I think that the second call was added, was to re-execute uuid_entity_presave, so it regenerates the vuuid key, after the old vid was removed.
But I think that is erroneous and it is not necessary, if you look at node_save() it also first calls hook_entity_presave(), and afterwards unsets the vid key, without calling the hook a second time.
Comment #3
alcroito CreditAttribution: alcroito commentedAttaching a patch that removes the second invocation to hook_entity_presave().
Comment #4
DamienMcKennaComment #6
DamienMcKennaCommitted. Thanks!