You are here

function weather_format_wind_direction in Weather 7.3

Same name and namespace in other branches
  1. 7.2 weather_theme.inc \weather_format_wind_direction()

Convert wind direction.

Parameters

string $wind_direction: Wind direction (Compass bearings, for example, '080')

array $settings: From views handler: use normal or abbreviated text, show degree.

Return value

string Formatted representation in the desired unit.

1 call to weather_format_wind_direction()
weather_handler_wind_direction::render in views_handlers/weather_handler_wind_direction.inc
Render wind information with selected unit.

File

./weather_theme.inc, line 387
Prepare themed weather output.

Code

function weather_format_wind_direction($wind_direction, $settings) {
  switch ($settings) {
    case 'normal_degree':
      $result = t('!direction (!degree°)', array(
        '!direction' => weather_bearing_to_text($wind_direction),
        '!degree' => $wind_direction,
      ));
      break;
    case 'abbreviated':
      $result = weather_bearing_to_text($wind_direction, TRUE);
      break;
    case 'abbreviated_degree':
      $result = t('!direction (!degree°)', array(
        '!direction' => weather_bearing_to_text($wind_direction, TRUE),
        '!degree' => $wind_direction,
      ));
      break;
    case 'degree':
      $result = t('!degree°', array(
        '!degree' => $wind_direction,
      ));
      break;
    case 'degree_value':
      $result = $wind_direction;
      break;
    default:
      $result = weather_bearing_to_text($wind_direction);
  }
  return $result;
}