uc_length_format

Versions
5 – 6
uc_length_format($value, $unit = NULL)

Format a length value for display.

▾ 3 functions call uc_length_format()

theme_uc_product_dimensions in contributions/ubercart/uc_product/uc_product.module
Format a product's length, width, and height.
uc_product_token_values in contributions/ubercart/uc_product/uc_product.module
Provide product token values.
uc_shipping_package_view in contributions/ubercart/shipping/uc_shipping/uc_shipping.module
Display the details of a package.

Code

contributions/ubercart/uc_store/uc_store.module, line 1918

<?php
function uc_length_format($value, $unit = NULL) {
  $vars = array('!value' => $value);

  if (is_null($unit)) {
    $unit = variable_get('uc_length_unit', 'in');
  }

  $defaults = array(
    'in' => '!valuein.',
    'ft' => '!valueft.',
    'cm' => '!valuecm',
    'mm' => '!valuemm',
  );

  $pattern = variable_get('uc_length_format_'. $unit, $defaults[$unit]);
  if (strpos($pattern, '!value') === FALSE) {
    $pattern = $defaults[$unit];
  }

  $format = strtr($pattern, $vars);

  return $format;
}
?>

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters (without spaces) shown in the image.