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:

  1. Enable "Retain original entity updated time" as outlined above.
  2. Edit a node that is not at the top of the list (i.e.: latest created and/or updated).
  3. Go to /admin/content.
  4. 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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

JQTNguyen created an issue. See original summary.

ThomWilhelm’s picture

+1 Just ran into this exact same issue. Was an absolute nightmare to find the cause of this.

ThomWilhelm’s picture

As 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.

ThomWilhelm’s picture

Status: Active » Needs review
b_sharpe’s picture

Status: Needs review » Fixed

Wow, 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.

  • b_sharpe committed 378c00d on 8.x-1.x authored by ThomWilhelm
    Issue #3026945 by ThomWilhelm, JQTNguyen: "Last Updated" does not update...
ThomWilhelm’s picture

Ah yeah good call on the edge case, hadn’t thought of that.

Thanks for committing, and the subsequent 1.0 release.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.