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.
When the "Retain original entity updated time" option is checked at /admin/config/system/field_defaults/settings, it has the effect of never updating the "Last Updated" value of a Node whenever it is edited, not just when Field Defaults is used.
Steps to duplicate:
- Enable "Retain original entity updated time" as outlined above.
- Edit a node that is not at the top of the list (i.e.: latest created and/or updated).
- Go to /admin/content.
- See that the edited node is not at the top of the list, and the "Updated" date is not changed.
Note: Dates on Revisions are stored and do appear updated.
Comment | File | Size | Author |
---|---|---|---|
#3 | last-updated-does-not-update-with-retain-option-3026945-2.patch | 999 bytes | ThomWilhelm |
Comments
Comment #2
ThomWilhelm CreditAttribution: ThomWilhelm commented+1 Just ran into this exact same issue. Was an absolute nightmare to find the cause of this.
Comment #3
ThomWilhelm CreditAttribution: ThomWilhelm commentedAs the changed date logic is handled by entity_presave, I think the only way to handle this is by setting an attribute on the entity to flag that it's being updated by the field_defaults module. Then in the entity_presave hook, we can check if this flag exists. If it's not there, we'll leave the changed value untouched.
Comment #4
ThomWilhelm CreditAttribution: ThomWilhelm commentedComment #5
b_sharpe CreditAttribution: b_sharpe at ImageX commentedWow, not sure what I was thinking there, what a dumb mistake!
Thanks for the patch, I have made one small modification in changing the attribute from 'field_defaults_update' to 'batch_field_defaults' as there is the rare possibility someone has a field called "Defaults Update" that would share a machine name.
Comment #7
ThomWilhelm CreditAttribution: ThomWilhelm commentedAh yeah good call on the edge case, hadn’t thought of that.
Thanks for committing, and the subsequent 1.0 release.