You are here

public function weather_handler_wind::render in Weather 7.3

Same name and namespace in other branches
  1. 7.2 views_handlers/weather_handler_wind.inc \weather_handler_wind::render()

Render wind information with selected unit.

Overrides views_handler_field::render

File

views_handlers/weather_handler_wind.inc, line 82
Views handler for weather module.

Class

weather_handler_wind
Field handler to render the wind condition.

Code

public function render($values) {
  if (is_null($values->{$this->field_alias})) {
    return;
  }
  $wind_direction = $values->{$this->field_alias};
  $wind_speed = $this
    ->get_value($values, 'wind_speed');

  // Check whether to use abbreviated directions.
  $abbreviated = strpos($this->options['wind_settings'], 'abbreviated') !== FALSE;

  // Check whether to use exact degrees.
  $exact_degree = strpos($this->options['wind_settings'], 'degree') !== FALSE;
  module_load_include('inc', 'weather', 'weather_theme');
  return weather_format_wind($wind_direction, $wind_speed, $this->options['unit'], $abbreviated, $exact_degree);
}