function location_search_validate in Location 6.3
Same name and namespace in other branches
- 5.3 contrib/location_search/location_search.module \location_search_validate()
- 7.5 contrib/location_search/location_search.module \location_search_validate()
- 7.3 contrib/location_search/location_search.module \location_search_validate()
- 7.4 contrib/location_search/location_search.module \location_search_validate()
1 string reference to 'location_search_validate'
- location_search_form_alter in contrib/
location_search/ location_search.module
File
- contrib/
location_search/ location_search.module, line 336 - Location search interface.
Code
function location_search_validate($form, &$form_state) {
$values = $form_state['values'];
// Initialise using any existing basic search keywords.
$keys = $values['processed_keys'];
if (!empty($values['country'])) {
$keys = search_query_insert($keys, 'country', $values['country']);
if (!empty($values['province'])) {
$keys = search_query_insert($keys, 'province', location_province_code($values['country'], $values['province']));
}
}
if (!empty($values['city'])) {
$keys = search_query_insert($keys, 'city', str_replace(' ', '_', $values['city']));
}
if (!empty($values['latitude']) && !empty($values['longitude']) && !empty($values['distance'])) {
$keys = search_query_insert($keys, 'from', $values['latitude'] . ',' . $values['longitude'] . ',' . $values['distance'] . ',' . $values['units']);
}
if (!empty($keys)) {
form_set_value($form['basic']['inline']['processed_keys'], trim($keys), $form_state);
}
}