.
*
* @param array $variables
* An associative array containing:
* - form: A render element representing the add-to-cart form.
*
* @ingroup themeable
*/
function theme_uc_product_add_to_cart($variables) {
$form = $variables['form'];
$output = '
';
$output .= drupal_render($form);
$output .= '
';
return $output;
}
/**
* Formats a product's price.
*
* @param array $variables
* An associative array containing:
* - element: An associative array render element containing:
* - #value: Price to be formatted.
* - #attributes: (optional) Array of attributes to apply to enclosing DIV.
* - #title: (optional) Title to be used as label.
*
* @ingroup themeable
*/
function theme_uc_product_price($variables) {
$element = $variables['element'];
$price = $element['#value'];
$attributes = isset($element['#attributes']) ? $element['#attributes'] : array();
$label = isset($element['#title']) ? $element['#title'] : '';
if (isset($attributes['class'])) {
array_unshift($attributes['class'], 'product-info');
}
else {
$attributes['class'] = array('product-info');
}
$output = '
';
if ($label) {
$output .= '' . $label . ' ';
}
$vars = array('price' => $price);
if (!empty($element['#suffixes'])) {
$vars['suffixes'] = $element['#suffixes'];
}
$output .= theme('uc_price', $vars);
$output .= drupal_render_children($element);
$output .= '
';
return $output;
}
/**
* Formats a product's weight.
*
* @param array $variables
* An associative array containing:
* - amount: A numerical weight value.
* - units: String abbreviation representing the units of measure.
* - attributes: (optional) Array of attributes to apply to enclosing DIV.
*
* @see uc_weight_format()
*
* @ingroup themeable
*/
function theme_uc_product_weight($variables) {
$amount = $variables['amount'];
$units = $variables['units'];
$attributes = $variables['attributes'];
$attributes['class'][] = "product-info";
$attributes['class'][] = "weight";
$output = '';
if ($amount) {
$output = '
';
$output .= '' . t('Weight') . ': ';
$output .= '' . uc_weight_format($amount, $units) . '';
$output .= '
';
}
return $output;
}
/**
* Formats a product's length, width, and height.
*
* @param array $variables
* An associative array containing:
* - length: A numerical length value.
* - width: A numerical width value.
* - height: A numerical height value.
* - units: String abbreviation representing the units of measure.
* - attributes: (optional) Array of attributes to apply to enclosing DIV.
*
* @see uc_length_format()
*
* @ingroup themeable
*/
function theme_uc_product_dimensions($variables) {
$length = $variables['length'];
$width = $variables['width'];
$height = $variables['height'];
$units = $variables['units'];
$attributes = $variables['attributes'];
$attributes['class'][] = "product-info";
$attributes['class'][] = "dimensions";
$output = '';
if ($length || $width || $height) {
$output = '
';
$output .= '' . t('Dimensions') . ': ';
$output .= '';
$output .= uc_length_format($length, $units) . ' × ';
$output .= uc_length_format($width, $units) . ' × ';
$output .= uc_length_format($height, $units) . '';
$output .= '
';
}
return $output;
}
/**
* Formats a product's images.
*
* @param 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 theme_image_style()
*
* @ingroup themeable
*/
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 = '
';
if (!empty($images)) {
$output .= '
';
}
$output .= '
';
$rel_count++;
return $output;
}