You are here

function theme_yr_verdata_temp in Yr Weatherdata 7

Same name and namespace in other branches
  1. 6.2 yr_verdata.module \theme_yr_verdata_temp()

Function for generating a themed temperature display.

Parameters

$vars: Array with two keys: unit: The unit the temperature is supplied in from yr.no. value: The value of the temperature in the given unit.

Return value

Returns a themed temperature.

3 theme calls to theme_yr_verdata_temp()
yr_verdata_generate in ./yr_verdata.module
Function for generating a forecast for a location. This function should only be called after having checked if there is an up-to-date cache available, as this will load and parse an xml-file, possibly getting it from a remote host first, which is…
yr_verdata_generate_forecastboxes in ./yr_verdata.module
Function for generating one or more forecast boxes for given periods.
yr_verdata_page_all in ./yr_verdata.module
Function for generating the main forecast page.

File

./yr_verdata.module, line 1050
yr_verdata.module This file contains the code for getting the forecast from yr.no and displaying it on a Drupal site.

Code

function theme_yr_verdata_temp($vars) {
  $temp = array(
    'unit' => $vars['temp']['unit'],
    'value' => $vars['temp']['value'],
  );
  $temp_unit = variable_get('yr_verdata_temp_unit', 'celsius');
  $tu_shorts = _yr_verdata_tu_shorts();
  $temp = _yr_verdata_temperature($temp);
  $temperature = '<span class="yr-temp ' . $temp['class'] . '">' . $temp[$temp_unit] . '&deg;' . $tu_shorts[$temp_unit] . '</span>';
  return $temperature;
}