You are here

function amazon_media_preprocess_amazon_item in Amazon Product Advertisement API 6

Same name and namespace in other branches
  1. 7.2 amazon_media/amazon_media.module \amazon_media_preprocess_amazon_item()
  2. 7 amazon_media/amazon_media.module \amazon_media_preprocess_amazon_item()

File

amazon_media/amazon_media.module, line 44

Code

function amazon_media_preprocess_amazon_item(&$variables) {
  if (!empty($variables['theatricalreleasedate'])) {
    $date = explode('-', $variables['theatricalreleasedate']);
    $variables['theatricalreleaseyear'] = $date[0];
  }
  else {
    $variables['theatricalreleaseyear'] = '';
  }
  if (!empty($variables['publicationdate'])) {
    $date = explode('-', $variables['publicationdate']);
    $variables['publicationyear'] = $date[0];
  }

  // Various bits we want to ensure have defaults.
  $variables += array(
    'director' => '',
    'actor' => '',
    'audiencerating' => t('NR - Not Rated'),
    'publicationyear' => '',
    'runningtime' => '',
    'theatricalreleaseyear' => '',
  );
}