Closed (fixed)
Project:
Focal Point
Version:
8.x-1.x-dev
Component:
Other Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
22 Dec 2019 at 10:34 UTC
Updated:
22 Apr 2020 at 21:59 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
ugolek commentedPatch is attached.
Comment #3
bleen commentedI think this is a nice enhancement ... I'd love to hear about your specific use-case
Comment #4
ugolek commentedHi bleen, my case is pretty simple.
For example, let's call function
update_metadatawhen entity has been update.So, I use drupal_register_shutdown_function in
hook_entity_update()to register a callback that should be triggered.So, does not matter what
update_metadatafunction should do, I want to update metadata only if the image has been updated, ie file id has changed. So, it is pretty simple to do, I just check $entity and $entity->original.I also want to update metadata, if the focal point coordinates has been changed too, because it could be a different metadata after the manipulations with the same image. There is no way to catch the previous saved value from the $entity->original. So, the only way is adding a new property like
focal_point_original, that keep the old value.Does it make sense?
Comment #5
maosmurf commentedHi all,
Our use-case is: we invalidate images from CDN, but only if the focal_point has changed.
So using
MODULE_entity_update(must usehook_entity_updatebecausehook_ENTITY_TYPE_updatewould be too early, irregardless of module weight) we checkThank you for the patch!
Comment #6
bleen commented@maosmurf ... have you tested the patch and confirmed it works as advertised?
Comment #7
maosmurf commented@bleen yes, we have it in production since last week - works as advertised.
Comment #8
bleen commentedbased on #7
Comment #10
bleen commentedAwesome ... thanks for this new feature
Comment #11
bleen commented