You are here

function theme_uc_product_image in Ubercart 6.2

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

Formats a product's images.

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

File

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

Code

function theme_uc_product_image($images, $teaser = 0, $page = 0) {
  static $rel_count = 0;

  // Get the current product image widget.
  $image_widget = uc_product_get_image_widget();
  $first = array_shift($images);
  $output = '<div class="product-image"><div class="main-product-image">';
  $output .= '<a href="' . imagecache_create_url('product_full', $first['filepath']) . '" title="' . $first['data']['title'] . '"';
  if ($image_widget) {
    $image_widget_func = $image_widget['callback'];
    $output .= $image_widget_func($rel_count);
  }
  $output .= '>';
  $output .= theme('imagecache', 'product', $first['filepath'], $first['data']['alt'], $first['data']['title']);
  $output .= '</a></div><div class="more-product-images">';
  foreach ($images as $thumbnail) {

    // Node preview adds extra values to $images that aren't files.
    if (!is_array($thumbnail) || empty($thumbnail['filepath'])) {
      continue;
    }
    $output .= '<a href="' . imagecache_create_url('product_full', $thumbnail['filepath']) . '" title="' . $thumbnail['data']['title'] . '"';
    if ($image_widget) {
      $output .= $image_widget_func($rel_count);
    }
    $output .= '>';
    $output .= theme('imagecache', 'uc_thumbnail', $thumbnail['filepath'], $thumbnail['data']['alt'], $thumbnail['data']['title']);
    $output .= '</a>';
  }
  $output .= '</div></div>';
  $rel_count++;
  return $output;
}