function uc_product_get_image_widget in Ubercart 6.2
Same name and namespace in other branches
- 7.3 uc_product/uc_product.module \uc_product_get_image_widget()
Finds the JavaScript image display module to use on product pages.
2 calls to uc_product_get_image_widget()
- theme_uc_product_image in uc_product/
uc_product.module - Formats a product's images.
- uc_product_get_picture in uc_product/
uc_product.module - Returns an HTML img tag based on a node's attached image.
File
- uc_product/
uc_product.module, line 1790 - The product module for Ubercart.
Code
function uc_product_get_image_widget() {
static $got_widget = FALSE, $image_widget = array();
// Get the current image widget, if any.
if (!$got_widget) {
// Invoke hook to find widgets.
$image_widgets = uc_store_get_image_widgets();
// Find widget preference, if any.
$widget_name = variable_get('uc_product_image_widget', NULL);
if ($widget_name == 'none') {
// Don't use any image widgets.
}
elseif ($widget_name != NULL) {
// Widget to use has been set in admin menu.
$image_widget = $image_widgets[$widget_name];
}
else {
// Widget to use has not been chosen, so default to first element of
// array, if any.
$keys = array_keys($image_widgets);
if ($keys) {
$image_widget = $image_widgets[$keys[0]];
variable_set('uc_product_image_widget', $keys[0]);
}
}
$got_widget = TRUE;
}
return $image_widget;
}