gmap_geo/gmap_geo.module, line 69
- Versions
- 6
gmap_geo_picker_process($element, $edit, $form_state, $form)
See the gmap_set_location() function in gmap.module and its' companion location_latlon_form() in location.inc
Code
<?php
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;
}
?> 