MTShop/code/web/modules/contrib/physical
Gdilove 6f7054591c change folder for dev 2023-11-16 17:29:07 +08:00
..
config/schema change folder for dev 2023-11-16 17:29:07 +08:00
css change folder for dev 2023-11-16 17:29:07 +08:00
src change folder for dev 2023-11-16 17:29:07 +08:00
tests change folder for dev 2023-11-16 17:29:07 +08:00
theme change folder for dev 2023-11-16 17:29:07 +08:00
.gitignore change folder for dev 2023-11-16 17:29:07 +08:00
.travis.yml change folder for dev 2023-11-16 17:29:07 +08:00
LICENSE.txt change folder for dev 2023-11-16 17:29:07 +08:00
README.md change folder for dev 2023-11-16 17:29:07 +08:00
composer.json change folder for dev 2023-11-16 17:29:07 +08:00
phpcs.xml change folder for dev 2023-11-16 17:29:07 +08:00
physical.info.yml change folder for dev 2023-11-16 17:29:07 +08:00
physical.libraries.yml change folder for dev 2023-11-16 17:29:07 +08:00
physical.services.yml change folder for dev 2023-11-16 17:29:07 +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);