protected function ThemeService::setWeatherVariables in Weather 8
Same name and namespace in other branches
- 2.0.x src/Service/ThemeService.php \Drupal\weather\Service\ThemeService::setWeatherVariables()
Adds basic weather variables.
1 call to ThemeService::setWeatherVariables()
- ThemeService::preprocessWeatherVariables in src/
Service/ ThemeService.php - Prepare variables to render weather display.
File
- src/
Service/ ThemeService.php, line 137
Class
- ThemeService
- ThemeService service.
Namespace
Drupal\weather\ServiceCode
protected function setWeatherVariables(&$variables, $idx, $place, $weather, bool $detailed = FALSE) {
$variables['weather'][$idx]['utc_offset'] = $weather['utc_offset'];
$variables['weather'][$idx]['name'] = $place->displayed_name->value;
$variables['weather'][$idx]['geoid'] = $place->geoid->target_id;
if (!$detailed) {
$link = $this->weatherHelper
->getLinkForGeoid($place->geoid->target_id, $variables['destination'], $variables['display_number']);
$variables['weather'][$idx]['link'] = Link::fromTextAndUrl($place->displayed_name->value, Url::fromUserInput($link));
}
$link = $this->weatherHelper
->getLinkForGeoid($place->geoid->target_id, 'yr.no');
$variables['weather'][$idx]['yr.no'] = $link;
}