function search_api_location_validate_distance in Search API Location 7.2
Helper function for validating a distance input.
1 string reference to 'search_api_location_validate_distance'
- search_api_location_page_form_search_api_page_search_form_alter in search_api_location_page/
search_api_location_page.module - Implements hook_form_FORM_ID_alter().
File
- ./
search_api_location.module, line 72 - Provides location based search functionality for the Search API.
Code
function search_api_location_validate_distance(array $element, array &$form_state) {
$value = $element['#value'];
if ($value != '' && !is_numeric($value) || (double) $value < 0) {
form_error($element, t('%name must be a non-negative number.', array(
'%name' => $element['#title'],
)));
}
}