Skip navigation
Help

theme_uc_product_weight

6 uc_product.module theme_uc_product_weight($weight, $unit = NULL, $teaser = 0, $page = 0)
7 uc_product.theme.inc theme_uc_product_weight($variables)

Formats a product's weight.

Parameters

$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 also

uc_weight_format()

Related topics

File

ubercart/uc_product/uc_product.theme.inc, line 105
Theme functions for uc_product module.

Code

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 = '<div ' . drupal_attributes($attributes) . '>';
    $output .= '<span class="product-info-label">' . t('Weight') . ':</span> ';
    $output .= '<span class="product-info-value">' . uc_weight_format($amount, $units) . '</span>';
    $output .= '</div>';
  }

  return $output;
}