MTShop/code/web/modules/contrib/physical
Gdilove c391965547 update config 2023-11-17 01:10:57 +08:00
..
config/schema update config 2023-11-17 01:10:57 +08:00
css update config 2023-11-17 01:10:57 +08:00
src update config 2023-11-17 01:10:57 +08:00
tests update config 2023-11-17 01:10:57 +08:00
theme update config 2023-11-17 01:10:57 +08:00
.gitignore update config 2023-11-17 01:10:57 +08:00
.travis.yml update config 2023-11-17 01:10:57 +08:00
LICENSE.txt update config 2023-11-17 01:10:57 +08:00
README.md update config 2023-11-17 01:10:57 +08:00
composer.json update config 2023-11-17 01:10:57 +08:00
phpcs.xml update config 2023-11-17 01:10:57 +08:00
physical.info.yml update config 2023-11-17 01:10:57 +08:00
physical.libraries.yml update config 2023-11-17 01:10:57 +08:00
physical.services.yml update config 2023-11-17 01:10:57 +08:00

README.md

Physical Fields

Provides an API for storing and manipulating physical measurements.

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:

  • Unit conversions
  • Language-specific number input and formatting
  • Value objects with support for bcmath-based arithmetic.
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);