You are here

public function WundergroundWeatherManager::getIconSetSample in Wunderground weather 8

Get a sample of icons of a icon set.

Parameters

string $set: The letter to identify an icon set.

Return value

string A div containing a sample of icons from an icon set.

File

src/WundergroundWeatherManager.php, line 97
Contains Drupal\wunderground_weather\WundergroundWeatherManager.

Class

WundergroundWeatherManager
Methods to make an API call and tool to handle the output.

Namespace

Drupal\wunderground_weather

Code

public function getIconSetSample($set) {
  $all_icons = $this
    ->getIconNames();
  $sample = [
    $all_icons[8],
    $all_icons[9],
    $all_icons[15],
    $all_icons[18],
    $all_icons[20],
  ];
  $sample_icons = '';
  foreach ($sample as $name) {
    $image_variables = [
      '#theme' => 'image',
      '#uri' => $this
        ->getIconUrl($set, $name),
    ];
    $sample_icons .= render($image_variables);
  }
  return $sample_icons;
}