You are here

function _weather_convert_settings in Weather 7

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

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

File

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

Code

function _weather_convert_settings($settings, $units) {
  $settings = unserialize($settings);
  $units = unserialize($units);
  $new = array();
  $new['data'] = array();
  if ($units['temperature'] != 'dont-display') {
    $new['data']['temperature'] = 'temperature';
  }
  if ($units['windspeed'] != 'dont-display') {
    $new['data']['wind'] = 'wind';
  }
  if ($units['pressure'] != 'dont-display') {
    $new['data']['pressure'] = 'pressure';
  }
  if ($units['humidity'] != 'dont-display') {
    $new['data']['humidity'] = 'humidity';
  }
  if ($units['visibility'] != 'dont-display') {
    $new['data']['visibility'] = 'visibility';
  }
  if ($settings['show_unconverted_metar']) {
    $new['data']['metar'] = 'metar';
  }
  if ($settings['show_sunrise_sunset']) {
    $new['data']['suninfo'] = 'suninfo';
  }
  $new['show_windchill'] = $settings['show_windchill'];
  $new['show_abbreviated_directions'] = $settings['show_abbreviated_directions'];
  $new['show_directions_degree'] = $settings['show_directions_degree'];
  $new['show_compact_block'] = $settings['show_compact_block'];
  return $new;
}