You are here

function wunderground_weather_get_forecast in Wunderground weather 7

Get forecast data and return a themed table.

Return value

string Html for the forecast block.

1 call to wunderground_weather_get_forecast()
wunderground_weather_block_view in ./wunderground_weather.module
Implements hook_block_view().

File

./wunderground_weather.module, line 385
Wunderground weather module to display weather forecasts and current weather conditions in blocks.

Code

function wunderground_weather_get_forecast($block_number) {
  $variables = _wunderground_weather_cache('forecast', $block_number);

  // Check if data is received.
  if ($variables['days']) {
    $output = theme('wunderground_weather_forecast', $variables);
  }
  else {

    // Return message if no data is retrieved.
    $output = t('No weather forecast available.');
    if (user_access('administer wunderground weather')) {
      $configure_path = 'admin/structure/block/manage/wunderground_weather/wunderground_weather_forecast_' . $block_number . '/configure';
      $output .= ' ' . l(t('Configure this block'), $configure_path);
    }
  }
  return $output;
}