You are here

function theme_yr_verdata_block in Yr Weatherdata 7

Same name and namespace in other branches
  1. 6.2 yr_verdata.module \theme_yr_verdata_block()

Theme function for the block display.

Parameters

$forecast: An array with the processed forecast information for the first period of this location.

Return value

Returns a themed output for a block.

File

./yr_verdata.module, line 799
yr_verdata.module This file contains the code for getting the forecast from yr.no and displaying it on a Drupal site.

Code

function theme_yr_verdata_block($forecast) {
  $output['forecast'] = array(
    '#prefix' => '<div class="yr-forecast-block-box">',
    '#suffix' => '</div>',
    'time' => array(
      '#markup' => $forecast[0]['time'],
      '#prefix' => '<p class="yr-period-time">',
      '#suffix' => '</p>',
    ),
    'symbol' => array(
      '#markup' => $forecast[0]['symbol'],
      '#prefix' => '<div class="yr-period-forecast"><p class="yr-symbols"><span class="yr-symbol">',
      '#suffix' => '</span>',
    ),
    'wind' => array(
      '#markup' => $forecast[0]['wind'],
      '#prefix' => '<span class="yr-wind">',
      '#suffix' => '</span>',
    ),
    'temp' => array(
      '#markup' => $forecast[0]['temp'],
      '#suffix' => '</p>',
    ),
    'precip' => array(
      '#markup' => $forecast[0]['precip'],
      '#prefix' => '<p class="yr-precip">',
      '#suffix' => '</p>',
    ),
    'pressure' => array(
      '#markup' => $forecast[0]['pressure'],
      '#prefix' => '<p class="yr-pressure">',
      '#suffix' => '</p></div>',
    ),
  );
  if (isset($forecast['name'])) {
    $output['forecast']['#prefix'] .= '<h4>' . l($forecast['name'], 'forecast/' . $forecast['yid']) . '</h4>';
  }
  return drupal_render($output);
}