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.
Problem/Motivation
In #2074191: [META] Add changed timestamp tracking to content entities, several entities in core are getting a changed timestamp. We should also expand changed timestamp checking constraints, so the cross-editing overwrite feature from core node forms also extends to these entities.
Proposed resolution
Generalize the node changed timestamp validator to the entity level. Ensure it only attempts to work with entities supporting EntityChangedInterface.
Remaining tasks
TBD.
User interface changes
None.
API changes
None.
Related Issues
#2074191: [META] Add changed timestamp tracking to content entities
Comment | File | Size | Author |
---|---|---|---|
#8 | entity-changed-validator-8.patch | 5.41 KB | twistor |
#6 | entity-changed-validator-6.patch | 5.71 KB | twistor |
#6 | interdiff.txt | 1.38 KB | twistor |
#4 | entity-changed-validator-3.patch | 6.06 KB | Gábor Hojtsy |
#3 | entity-changed-validator-3.patch | 0 bytes | Gábor Hojtsy |
Comments
Comment #1
Gábor HojtsyHere is a quick untested proof of concept :) After talking to Berdir about this in IRC, he suggested we generalize the validation, so, it would look something like this I think.
Comment #2
Berdirentity_load_unchanged()
Comment #3
Gábor HojtsySure thing.
Comment #4
Gábor HojtsyNon-empty version :D
Comment #6
twistor CreditAttribution: twistor commentedComment #8
twistor CreditAttribution: twistor commentedMove the validator from the entity module to Drupal\Core\Validation\Plugin\Validation\Constraint to be with the other validators.
Added EntityChangedInterface use statement.
Comment #9
Gábor HojtsyIs there any test coverage for this somewhere?
Comment #10
twistor CreditAttribution: twistor commentedNodeValidationTest checks for this explicitly. That was one of the failures in #5.
Comment #11
Gábor HojtsyThat sounds great actually. So we have a test proving this works even on a general level now. IMHO we don't need a test to ensure all implementations, we don't test fieldability on all entities or other similar common APIs either. Let's get this in then :)
Comment #12
webchickLooks good.
Committed and pushed to 8.x. Thanks!
Comment #13
webchickHm. Actually.
Comment #14
Gábor HojtsyI think I wrote https://drupal.org/node/2085445 which is IMHO as complete as such a change notice can get. So closing.