You are here

function location_search_validate in Location 5.3

Same name and namespace in other branches
  1. 6.3 contrib/location_search/location_search.module \location_search_validate()
  2. 7.5 contrib/location_search/location_search.module \location_search_validate()
  3. 7.3 contrib/location_search/location_search.module \location_search_validate()
  4. 7.4 contrib/location_search/location_search.module \location_search_validate()

File

contrib/location_search/location_search.module, line 272
Location search interface.

Code

function location_search_validate($form_id, $form_values, $form) {

  // Initialise using any existing basic search keywords.
  $keys = $form_values['processed_keys'];
  if (!empty($form_values['country'])) {
    $keys = search_query_insert($keys, 'country', $form_values['country']);
    if (!empty($form_values['province'])) {
      $keys = search_query_insert($keys, 'province', location_province_code($form_values['country'], $form_values['province']));
    }
  }
  if (!empty($form_values['city'])) {
    $keys = search_query_insert($keys, 'city', $form_values['city']);
  }
  if (!empty($form_values['latitude']) && !empty($form_values['longitude']) && !empty($form_values['distance'])) {
    $keys = search_query_insert($keys, 'from', $form_values['latitude'] . ',' . $form_values['longitude'] . ',' . $form_values['distance'] . ',' . $form_values['units']);
  }
  if (!empty($keys)) {
    form_set_value($form['basic']['inline']['processed_keys'], trim($keys));
  }
}