function _weather_format_temperature in Weather 5.6
Same name and namespace in other branches
- 5 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 (celsius, fahrenheit):
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 1081 - Display <acronym title="METeorological Aerodrome Report">METAR</acronym> weather data from anywhere in the world
Code
function _weather_format_temperature($temperature, $unit) {
if ($unit['temperature'] == 'fahrenheit') {
return t('!temperature °F', array(
'!temperature' => $temperature['fahrenheit'],
));
}
else {
// default to metric units
return t('!temperature °C', array(
'!temperature' => $temperature['celsius'],
));
}
}