function theme_uc_product_image in Ubercart 7.3
Same name and namespace in other branches
- 5 uc_product/uc_product.module \theme_uc_product_image()
- 6.2 uc_product/uc_product.module \theme_uc_product_image()
Formats a product's images.
Parameters
array $variables:
- images: An array of image render elements, each containing:
- uri: URI of image.
- alt: Alternate text to display for image.
- title: Title for image.
See also
1 theme call to theme_uc_product_image()
- uc_product_field_formatter_view in uc_product/
uc_product.module - Implements hook_field_formatter_view().
File
- uc_product/
uc_product.theme.inc, line 176 - Theme functions for uc_product module.
Code
function theme_uc_product_image($variables) {
static $rel_count = 0;
$images = $variables['images'];
// 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="' . image_style_url('uc_product_full', $first['uri']) . '" title="' . $first['title'] . '"';
if ($image_widget) {
$image_widget_func = $image_widget['callback'];
$output .= $image_widget_func($rel_count);
}
$output .= '>';
$output .= theme('image_style', array(
'style_name' => 'uc_product',
'path' => $first['uri'],
'alt' => $first['alt'],
'title' => $first['title'],
));
$output .= '</a></div>';
if (!empty($images)) {
$output .= '<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['uri'])) {
continue;
}
$output .= '<a href="' . image_style_url('uc_product_full', $thumbnail['uri']) . '" title="' . $thumbnail['title'] . '"';
if ($image_widget) {
$output .= $image_widget_func($rel_count);
}
$output .= '>';
$output .= theme('image_style', array(
'style_name' => 'uc_thumbnail',
'path' => $thumbnail['uri'],
'alt' => $thumbnail['alt'],
'title' => $thumbnail['title'],
));
$output .= '</a>';
}
$output .= '</div>';
}
$output .= '</div>';
$rel_count++;
return $output;
}