You are here

function theme_uc_product_dimensions in Ubercart 7.3

Same name and namespace in other branches
  1. 5 uc_product/uc_product.module \theme_uc_product_dimensions()
  2. 6.2 uc_product/uc_product.module \theme_uc_product_dimensions()

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

uc_length_format()

1 theme call to theme_uc_product_dimensions()
uc_product_view in uc_product/uc_product.module
Implements hook_view().

File

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;
}