You are here

function units_get_unit_names in Units of Measurement 6

Return array of unit names keyed by unit id's

Parameters

$full: if not null, return full names, otherwise short names.

File

./units.module, line 71
Units module.

Code

function units_get_unit_names($full = NULL) {
  $names = array();
  $units = units_get_units();
  if ($full) {
    foreach ($units as $id => $unit) {
      $names[$id] = $unit['fullname'];
    }
  }
  else {
    foreach ($units as $id => $unit) {
      $names[$id] = $unit['shortname'];
    }
  }
  return $names;
}