You are here

function yr_verdata_forecastbox in Yr Weatherdata 7

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

Function for generating the html tags for one box with forecast for a period.

Parameters

$item: The period item with all required and pre-processed forecast data.

Return value

Returns an array to be used in a render array for output.

3 calls to yr_verdata_forecastbox()
theme_yr_verdata_forecast in ./yr_verdata.module
Theme function for displaying the forecast for a location on that location's main forecast page. Caching is done for the whole page, so we don't need to do it here.
theme_yr_verdata_information in ./yr_verdata.module
Theme function for displaying the location information about a location on that location's main forecast page. Caching is done for the whole page, so we don't need to do it here.
yr_verdata_page_all in ./yr_verdata.module
Function for generating the main forecast page.

File

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

Code

function yr_verdata_forecastbox($item) {
  return array(
    '#prefix' => '<div class="yr-forecast-box">',
    '#suffix' => '</div>',
    'time' => array(
      '#markup' => $item['time'],
      '#prefix' => '<p class="yr-period-time">',
      '#suffix' => '</p>',
    ),
    'symbol' => array(
      '#markup' => $item['symbol'],
      '#prefix' => '<div class="yr-period-forecast"><p class="yr-symbols"><span class="yr-symbol">',
      '#suffix' => '</span>',
    ),
    'wind' => array(
      '#markup' => $item['wind'],
      '#prefix' => '<span class="yr-wind">',
      '#suffix' => '</span>',
    ),
    'temp' => array(
      '#markup' => $item['temp'],
      '#suffix' => '</p>',
    ),
    'precip' => array(
      '#markup' => $item['precip'],
      '#prefix' => '<p class="yr-precip">',
      '#suffix' => '</p>',
    ),
    'pressure' => array(
      '#markup' => $item['pressure'],
      '#prefix' => '<p class="yr-pressure">',
      '#suffix' => '</p></div>',
    ),
  );
}