6 uc_product.module | theme_uc_product_dimensions( |
7 uc_product.theme.inc | theme_uc_product_dimensions($variables) |
Formats a product's length, width, and height.
Parameters
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 also
Related topics
File
- ubercart/
uc_product/ uc_product.theme.inc, line 140 - Theme functions for uc_product module.
Code
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 = '<div ' . drupal_attributes($attributes) . '>';
$output .= '<span class="product-info-label">' . t('Dimensions') . ':</span> ';
$output .= '<span class="product-info-value">';
$output .= uc_length_format($length, $units) . ' × ';
$output .= uc_length_format($width, $units) . ' × ';
$output .= uc_length_format($height, $units) . '</span>';
$output .= '</div>';
}
return $output;
}