Problem/Motivation
Per issue https://www.drupal.org/project/entity_clone/issues/2724939, the created date of the cloned entity becomes the current date. Though the last modified date stays the same as the original entity, which is before the cloned entity's created date (in theory not even possible). This should also be the current date.
Another annoying side effect is that the newly created entity appears somewhere down the content list in the admin overview, instead of on top like every other new content item.
Steps to reproduce
Clone for example an old node (with old last-modified date) and afterwards search for it in the content view /admin/content. You won't find it on top of the list like it should, because the list is sorted by the last modified date.
Proposed resolution
While cloning the entity, set its last modified date to the current date, just like the created date. Perhaps make it a setting so we can choose the behaviour.
Remaining tasks
- Write a patch
- Review and feedback
- RTBC and feedback
- Commit
- Release
User interface changes
None, unless extra settings are provided.
API changes
None.
Data model changes
None.
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | 3216900-13.patch | 10.81 KB | upchuk |
| #10 | interdiff-3216900-7-9.txt | 7.34 KB | upchuk |
| #10 | 3216900-9.patch | 10.57 KB | upchuk |
| #7 | 3216900-7.patch | 6.82 KB | upchuk |
| #3 | 3216900-3.patch | 3.61 KB | guilhermevp |
Comments
Comment #2
guilhermevp commentedComment #3
guilhermevp commentedCreated a patch for it, but it doesn't have test yet, just want to know if this is exactly what you want.
Comment #4
fernly commentedThanks for the quick response. Very good that it's optional and it does what this issue was requesting.
A remark concerning the concept:
Some small styling remarks:
Set a space after the comment slashes.
No period sign required for the checkbox label.
A period sign is required for the description sentence.
No period sign is required for the checkbox label.
Typo: wheter => whether
Comment #5
fernly commentedComment #6
guilhermevp commentedHi @Fernly Thanks for your Feedback! I'll work on it!
Comment #7
upchuk commentedActually, it doesn't make that much sense to make this configurable. I find it difficult to believe there is a use case where a cloned entity's update date should ever be before the created one.
Moreover, when setting the updated date, we should check if there is such a field. Luckily for this there is an interface.
I created a patch with test refactor that tests both created and updated dates for nodes.
Comment #8
upchuk commentedFollowing from https://www.drupal.org/project/entity_clone/issues/3266268, I need to add also handling for translations.
Comment #10
upchuk commentedHere we are, setting the created/updated dates also on the translations + minor refactor + tests.
Comment #11
joevagyok commentedReviewed and tested the patch. Works as designed. Thank you, moving it to RTBC.
Comment #12
sinn commentedPatch #10 works well.
Comment #13
upchuk commentedRerolling and re-running tests.
Comment #15
upchuk commentedMerged