You are here

function _weather_convert_units in Weather 7

Converts units from 6.x to 7.x module versions.

1 call to _weather_convert_units()
weather_update_7100 in ./weather.install
Implement hook_update_N().

File

./weather.install, line 531
Install, update and uninstall functions for the weather module.

Code

function _weather_convert_units($units) {
  $units = unserialize($units);
  $new = array();
  $new['temperature'] = $units['temperature'];
  if ($new['temperature'] == 'dont-display') {
    $new['temperature'] = 'celsius';
  }
  $new['windspeed'] = $units['windspeed'];
  if ($new['windspeed'] == 'dont-display') {
    $new['windspeed'] = 'kmh';
  }
  $new['pressure'] = $units['pressure'];
  if ($new['pressure'] == 'dont-display') {
    $new['pressure'] = 'hpa';
  }
  $new['distance'] = $units['visibility'];
  if ($new['distance'] == 'dont-display') {
    $new['distance'] = 'kilometers';
  }
  return $new;
}