function getlocations_element_validate_latlon in Get Locations 7
Same name and namespace in other branches
- 7.2 getlocations.module \getlocations_element_validate_latlon()
Function
Return value
Returns
4 string references to 'getlocations_element_validate_latlon'
- getlocations_fields_field_settings_form in modules/
getlocations_fields/ getlocations_fields.module - Implements hook_field_settings_form(). Add settings to a field settings form.
- getlocations_leaflet_field_formatter_settings_form in modules/
getlocations_leaflet/ getlocations_leaflet.module - Implements hook_field_formatter_settings_form(). Returns form elements for a formatter's settings.
- getlocations_mapquest_field_formatter_settings_form in modules/
getlocations_mapquest/ getlocations_mapquest.module - Implements hook_field_formatter_settings_form(). Returns form elements for a formatter's settings.
- getlocations_map_field_formatter_settings_form in modules/
getlocations_map/ getlocations_map.module - Implements hook_field_formatter_settings_form(). Returns form elements for a formatter's settings.
File
- ./
getlocations.module, line 6057 - getlocations.module @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL
Code
function getlocations_element_validate_latlon($element, &$form_state) {
$value = FALSE;
if (isset($element['#value'])) {
$value = $element['#value'];
}
elseif (isset($element['#default_value'])) {
$value = $element['#default_value'];
}
$check = getlocations_latlon_check($value);
if (!$check) {
form_error($element, t('%name must be expressed as a decimal latitude and longitude, separated by a comma.', array(
'%name' => $element['#title'],
)));
}
else {
$parents = $element['#parents'];
// not a good solution
$tot = count($parents);
if ($tot == 3) {
$form_state['values'][$parents[0]][$parents[1]][$parents[2]] = $check;
}
elseif ($tot == 5) {
$form_state['values'][$parents[0]][$parents[1]][$parents[2]][$parents[3]][$parents[4]] = $check;
}
}
}