You are here

function _weather_format_pressure in Weather 5.6

Same name and namespace in other branches
  1. 5 weather.module \_weather_format_pressure()
  2. 6.5 weather.module \_weather_format_pressure()

Convert pressure

Parameters

int Pressure:

string The unit to be returned (inHg, mmHg, hPa):

Return value

string Formatted representation

1 call to _weather_format_pressure()
theme_weather in ./weather.module
Custom theme function for the weather block output

File

./weather.module, line 1237
Display <acronym title="METeorological Aerodrome Report">METAR</acronym> weather data from anywhere in the world

Code

function _weather_format_pressure($pressure, $unit) {
  if ($unit['pressure'] == 'inhg') {
    return t('!pressure inHg', array(
      '!pressure' => $pressure['inHg'],
    ));
  }
  else {
    if ($unit['pressure'] == 'mmhg') {
      return t('!pressure mmHg', array(
        '!pressure' => $pressure['mmHg'],
      ));
    }
    else {

      // default to metric units
      return t('!pressure hPa', array(
        '!pressure' => $pressure['hPa'],
      ));
    }
  }
}