Summary
I need to edit some data before it gets saved, and hook_field_presave()
looks like exactly what I need, but it doesn't get called for some reason.
The Scenario
I'd like to edit data coming from changes to the location field (location module), so that I can look up latitude and longitude information when none is provided and make sure it gets saved.
The implementation
At the moment I'm just adding the hook to the location.module for testing purposes before moving them into a separate module. The code I'm using is this:
function location_field_presave($entity_type, $entity, $field, $instance, $langcode, &$items) {
watchdog('location', 'testing location_field_presave', array(), WATCHDOG_NOTICE);
}
However, the dblog is never updated with my message; the code never runs.