Physical Fields
Security covered
This module provides an API for storing and manipulating physical measurements. It also supports unit conversions.
Features
Supported measurement types:
- Area
- Length
- Temperature
- Volume
- Weight
Provided field types:
- Physical measurement: Stores a single measurement and its unit.
- Physical dimensions: Stores the length/width/height measurements and their unit.
Other features:
- Language-specific number input and formatting
- Value objects with support for bcmath-based arithmetic.
Drupal 9 & 10 & 11
Installation
Physical should only be installed via Composer. The zip files on this page are provided for informative purposes only.
Drupal 9 or newer is required.
Example:use Drupal\physical\Weight;
use Drupal\physical\WeightUnit;
$weight = new Weight('100', WeightUnit::KILOGRAM);
$other_weight = new Weight('120', WeightUnit::KILOGRAM);
// Add the two weights together then express them in pounds.
$new_weight = $weight->add($other_weight)->convert(WeightUnit::POUND);
Incompatibility notes
Physical 1.3+ is incompatible with Commerce versions prior to 2.34 (See https://www.drupal.org/project/physical/issues/3345698#comment-15019339).
Depends on
Dependencies of the latest stable release
No dependencies recorded for this project.
Required by
1 tracked project depends on this one
- Commerce Shipping 15,636 sites
Activity
Releases
| Version | Type | Core | Notes | Release date | |
|---|---|---|---|---|---|
| 8.x-1.5 | Stable | Oct 29, 2024 |