You are here

function geolocation_googlemaps_field_widget_set_value in Geolocation Field 7

1 string reference to 'geolocation_googlemaps_field_widget_set_value'
geolocation_googlemaps_field_widget_form in modules/geolocation_googlemaps/geolocation_googlemaps.module
Implements hook_field_widget_form().

File

modules/geolocation_googlemaps/geolocation_googlemaps.module, line 521
Google Maps widget and formatters for Geolocation.

Code

function geolocation_googlemaps_field_widget_set_value($element, &$form_state, $form) {
  $values =& drupal_array_get_nested_value($form_state['values'], $element['#parents']);
  if ($values['field_type'] == 'geofield') {

    // Geofield needs the values in their own format which is exactly what
    // geofield_compute_values does, but we have to change first the longitude
    // key because geofield uses a different one.
    $values['lon'] = $values['lng'];
    $values = geofield_compute_values($values);
  }
}