You are here

function theme_uc_product_image in Ubercart 5

Same name and namespace in other branches
  1. 6.2 uc_product/uc_product.module \theme_uc_product_image()
  2. 7.3 uc_product/uc_product.theme.inc \theme_uc_product_image()

Format a product's images with imagecache and Thickbox.

2 theme calls to theme_uc_product_image()
uc_product_kit_view in uc_product_kit/uc_product_kit.module
Implementation of hook_view().
uc_product_view in uc_product/uc_product.module
Implementation of hook_view().

File

uc_product/uc_product.module, line 2455
The product module for Ubercart.

Code

function theme_uc_product_image($images, $teaser = 0, $page = 0) {
  static $rel_count = 0;
  $thickbox_enabled = module_exists('thickbox');
  $first = array_shift($images);
  $output = '<div class="product_image">';
  if ($thickbox_enabled) {
    $output .= '<a href="' . check_url(file_create_url($first['filepath'])) . '" title="' . $first['title'] . '" class="thickbox" rel="field_image_cache_' . $rel_count . '">';
  }
  $output .= theme('imagecache', 'product', $first['filepath'], $first['alt'], $first['title']);

  /* if (count($images)) {
      $output .= '<br />'. t('Click for more images.');
    } */
  if ($thickbox_enabled) {
    $output .= '</a>';
  }
  $output .= '<br />';
  foreach ($images as $thumbnail) {
    if ($thickbox_enabled) {
      $output .= '<a href="' . check_url(file_create_url($thumbnail['filepath'])) . '" title="' . $thumbnail['title'] . '" class="thickbox" rel="field_image_cache_' . $rel_count . '">';
    }
    $output .= theme('imagecache', 'uc_thumbnail', $thumbnail['filepath'], $thumbnail['alt'], $thumbnail['title']);
    if ($thickbox_enabled) {
      $output .= '</a>';
    }
  }
  $output .= '</div>';
  $rel_count++;
  return $output;
}