Hi,
If you create a node with a non-empty address then you edit the same node and remove the address, the geocoded data remains the same and the map still shows up.
I understand that geocoder ignores empty addresses but it may also delete old informations.
Regards.
PS : take care of the hook_field_is_empty implementation on addressfields which is being improved #1263316: Configurable non-empty value conditions
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | geocoder-clear-value-when-address-removed-1777934-1.patch | 508 bytes | duaelfr |
Comments
Comment #1
duaelfrHere is a patch.
Comment #2
phayes commentedThanks! Fixed.
Comment #4
jackbravo commentedThis fix introduces a bug described here:
https://drupal.org/node/1992762
I would like to re open this, but I think the correct approach is to open a new one right? So I guess the right way forward is fixing that new issue right?
Comment #5
the666bbq commentedcan't you just return an empty array on
// If no valid source values were passed.
if (empty($source_field_values)) {
like you do on
if (empty($geometries)) {
this invokes deleting saved data, rather than returning false which invokes 'do nothing'.
Comment #6
ergophobe commentedjackbravo's patch in #1992762: Programmatic Update of an entity empties a geofield due to regression introduced/exposed in issue #1777934 solves this problem for me and does not introduce the other issue when editing a node and saving with unchanged location data (see the referenced issue)
Comment #7
johnhanley commentedI'm not sure if this patch made it into dev (I'm using 7.x-1.2), but the implementing the above hook in a custom module fixed erroneous geo points for addresses with only a default country (which results in points placed in the middle of the country.)