function gmap_geo_picker_process in GMap Addons 7
Same name and namespace in other branches
- 6 gmap_geo/gmap_geo.module \gmap_geo_picker_process()
See the gmap_set_location() function in gmap.module and its' companion location_latlon_form() in location.inc
1 string reference to 'gmap_geo_picker_process'
- gmap_geo_elements in gmap_geo/
gmap_geo.module - Implementation of FAPI hook_elements().
File
- gmap_geo/
gmap_geo.module, line 69 - Provides a Google maps location picker widget for Geo cck fields. Provides a field formatter for Geo fields that displays point, line, or polygon data on a Google map.
Code
function gmap_geo_picker_process($element, $edit, $form_state, $form) {
$field = $form['#field_info'][$element['#field_name']];
$element['#title'] = $field['widget']['label'];
$element['#type'] = 'fieldset';
$element['map'] = array();
// reserve spot at top of form for map
$element['lat'] = array(
'#type' => 'textfield',
'#title' => t('Latitude'),
'#default_value' => isset($element['#value']['lat']) ? $element['#value']['lat'] : NULL,
'#required' => $field['required'],
'#size' => 15,
'#prefix' => '<div class="container-inline">',
);
$element['lon'] = array(
'#type' => 'textfield',
'#title' => t('Longitude'),
'#default_value' => isset($element['#value']['lon']) ? $element['#value']['lon'] : NULL,
'#required' => $field['required'],
'#size' => 15,
'#suffix' => '</div>',
);
$element['wkt'] = array(
'#type' => 'value',
'#value' => isset($element['#value']['wkt']) ? $element['#value']['wkt'] : NULL,
);
$element['map']['gmap']['#value'] = gmap_set_location($field['widget']['gmap_geo_picker_macro'], $element, array(
'latitude' => 'lat',
'longitude' => 'lon',
));
$element['map_instructions'] = array(
'#type' => 'markup',
'#weight' => 2,
'#prefix' => '<div class=\'description\'>',
'#value' => t('You may set the location by clicking on the map, or dragging the location marker. To clear the location, click on the marker.'),
'#suffix' => '</div>',
);
return $element;
}