You are here

function ip_geoloc_set_location_from_region in IP Geolocation Views & Maps 7

1 call to ip_geoloc_set_location_from_region()
_ip_geoloc_process_go_to_submit in ./ip_geoloc_blocks.inc
Submit handler to either go to a Region or "Move to" a street address.

File

./ip_geoloc_blocks.inc, line 782
Blocks available in IP Geolocation Views & Maps.

Code

function ip_geoloc_set_location_from_region($region_name_or_tid) {
  if (!is_numeric($region_name_or_tid)) {
    $geo_vocabulary_id = variable_get('ip_geoloc_geo_vocabulary_id', 0);
    foreach (taxonomy_get_tree($geo_vocabulary_id) as $term) {
      if (strcasecmp($term->name, $region_name_or_tid) === 0) {
        $region_name_or_tid = $term->tid;
        break;
      }
    }
  }
  $parent = variable_get('ip_geoloc_region_parent', 0);
  $location = ip_geoloc_get_location_from_term($region_name_or_tid, $parent);
  $location['fixed_address'] = 2;
  return $location;
}