You are here

function theme_yr_verdata_precip in Yr Weatherdata 6.2

Same name and namespace in other branches
  1. 7 yr_verdata.module \theme_yr_verdata_precip()

Function for generating the precipitation value for one forecast period.

Parameters

$vars: The precipitation property from the loaded xml object. Only needed attribute is 'value'.

Return value

Returns a precipitation value in the unit specified in yr_verdata preferences.

1 theme call to theme_yr_verdata_precip()
yr_verdata_generate_forecastboxes in ./yr_verdata.module
Function for generating one or more forecast boxes for given periods.

File

./yr_verdata.module, line 806
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_precip($vars) {
  $precipitation = array(
    'mm' => $vars['value'],
    'in' => bcdiv($vars['value'], 25.4, 2),
  );
  $unit = variable_get('yr_verdata_precip_unit', 'mm');
  $output = t('@value @unit precipitation', array(
    '@value' => $precipitation[$unit],
    '@unit' => $unit,
  ));
  return $output;
}