You are here

protected function WeatherHourlyBlock::getImage in Wunderground weather 8

Render a weather icon image.

Parameters

\stdClass $hour: The hour for that holds the icon variable.

Return value

string|null The rendered element.

File

src/Plugin/Block/WeatherHourlyBlock.php, line 252
Contains \Drupal\wunderground_weather\Plugin\Block\WeatherHourlyBlock.

Class

WeatherHourlyBlock
Provides a with an hourly weather forecast.

Namespace

Drupal\wunderground_weather\Plugin\Block

Code

protected function getImage(\stdClass $hour) {
  $config = $this
    ->getConfiguration();
  $icon = [
    '#theme' => 'image',
    '#uri' => $this->wundergroundWeatherManager
      ->getIconUrl($config['icon_set'], $hour->icon),
    '#alt' => $hour->condition,
  ];
  return render($icon);
}