function physical_dimensions_format in Physical Fields 7
Returns the formatted dimensions string for the given dimensions value array.
Parameters
$value: A dimension field value array containing length, width, height, and unit keys.
1 call to physical_dimensions_format()
- physical_field_formatter_view in ./
physical.module - Implements hook_field_formatter_view().
File
- ./
physical.module, line 1197 - Defines fields (e.g. weight and dimensions) to support describing the physical attributes of entities.
Code
function physical_dimensions_format($value) {
// Create an array of rounded values.
$data = array();
foreach (physical_dimensions() as $key => $dimension) {
$data[] = round($value[$key], 5);
}
// Return the rounded values joined together with the unit abbreviation appended.
return implode(' × ', $data) . ' ' . physical_dimension_unit_abbreviation($value['unit']);
}