You are here

function geofield_field_update_instance in Geofield 7.2

Implements hook_field_update_instance().

We implement this hook to prevent instance settings that may not apply to our different widgets from breaking when switching widgets. See http://drupal.org/node/1840920.

File

./geofield.module, line 66

Code

function geofield_field_update_instance($instance, $prior_instance) {
  if (!empty($instance['widget']['type']) && !empty($prior_instance['widget']['type']) && $instance['widget']['type'] != $prior_instance['widget']['type']) {
    $instance['default_value'] = array();
    _field_write_instance($instance, TRUE);
    field_cache_clear();
  }
}