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.
In the mission to backport D8's Edit module to D7, we need to perform some investigation to see if the same approach (using TempStore to store edits in between field edits) is possible in D7 or not.
Comment | File | Size | Author |
---|---|---|---|
#2 | edit_ctools_object_cache_experiment.mp4_.zip | 19.77 MB | Wim Leers |
#2 | edit_ctools_object_cache_experiment.patch | 3.89 KB | Wim Leers |
Comments
Comment #1
Wim LeersComment #2
Wim LeersWhat?
The patch that implemented this in D8 can be found at #1901100-48: Make Edit module work with TempStore, so revisions are not saved on all atomic field edits (that is the back-end part, the front-end part of it was done in #1678002: Edit should provide a usable entity-level toolbar for saving fields). D8's
TempStore
is inspired by/based on CTools' "object cache" in D7.Fears
I was pretty sure that
ctools_object_cache_(get|set|clear)()
will work for us.What I was less certain of, is whether we can make these D8 code blocks work in D7, which may very well only be possible thanks to the vast improvements to Entity API in D8:
$entity->save()
save to TempStore instead of DBExperiment
So, to check whether this was a founded fear or not, I set out to build a small experiment, employing the same strategy that we used for #1901100 and #1678002: the former is for the back-end implementation, with a new endpoint to hit to let the end-user decide "I'm done making edits, now I want them to be saved", the latter is the front-end to make all that work nicely.
I'm happy to report that it was a success! See the attached patch and accompanying 60-second screencast that shows it in action.
This experiment proves that it is viable to backport the exact UI/UX we have in Drupal 8, which will allow us to decrease the maintenance effort significantly. It's still possible and actually even likely that the Drupal 7 backport will require additional work-arounds for dealing with "extra fields" like the node title, node author and node date. But I'm confident those hurdles will be surmountable.
Comment #3
webchickThis is GREAT news!!!! :D
Comment #4
Gábor HojtsyI agree the experiment proves it should definitely be possible. Yay!
Comment #5
Wim Leers