function _weather_format_temperature in Weather 5
Same name and namespace in other branches
- 5.6 weather.module \_weather_format_temperature()
- 6.5 weather.module \_weather_format_temperature()
Convert temperatures
Parameters
int Temperature, always in degree celsius:
string The unit to be returned (metric, imperial):
Return value
string Formatted representation, either in celsius or fahrenheit
1 call to _weather_format_temperature()
- theme_weather in ./
weather.module - Custom theme function for the weather block output
File
- ./
weather.module, line 703 - Display <acronym title="METeorological Aerodrome Report">METAR</acronym> weather data from anywhere in the world
Code
function _weather_format_temperature($temperature, $unit) {
if (!isset($temperature)) {
return t('No data');
}
if ($unit == 'imperial') {
return t('!temperature °F', array(
'!temperature' => $temperature['fahrenheit'],
));
}
else {
// default to metric units
return t('!temperature °C', array(
'!temperature' => $temperature['celsius'],
));
}
}