You are here

function template_preprocess_gallery_teaser in Node Gallery 6.2

File

theme/theme.inc, line 31
theme/theme.inc Node gallery theme functions

Code

function template_preprocess_gallery_teaser(&$vars) {
  $gallery = $vars['gallery'];
  $config = $vars['config'];

  //cover display
  if ($config['teaser']['gallery_display_type'] == 'cover') {
    $cover = node_gallery_get_cover($gallery);
    $image_tag = theme('image_view', $config['image_size']['cover'], $cover);
    $teaser = l($image_tag, 'node/' . $gallery->nid, array(
      'html' => TRUE,
    ));
  }
  else {
    $display_num = $config['teaser']['thumbnails_num'];
    $i = 0;

    // Make sure to avoid an "Invalid argument supplied for foreach()" error
    if ($gallery->images) {
      foreach ($gallery->images as $image) {
        if ($i < $display_num) {
          $image_tag = theme('gallery_image_thumbnail', $image, $config, NODE_GALLERY_VIEW_TEASER);
          $items[] = l($image_tag, 'node/' . $gallery->nid, array(
            'html' => TRUE,
          ));
          $i++;
        }
      }
    }
    $teaser = $items;
  }
  $vars['gallery_teaser'] = $teaser;
}