v1/web/modules/contrib/physical
Gdilove 927f32325b 初始化 2023-11-13 20:36:13 +08:00
..
config/schema 初始化 2023-11-13 20:36:13 +08:00
css 初始化 2023-11-13 20:36:13 +08:00
src 初始化 2023-11-13 20:36:13 +08:00
tests 初始化 2023-11-13 20:36:13 +08:00
theme 初始化 2023-11-13 20:36:13 +08:00
.gitignore 初始化 2023-11-13 20:36:13 +08:00
.travis.yml 初始化 2023-11-13 20:36:13 +08:00
LICENSE.txt 初始化 2023-11-13 20:36:13 +08:00
README.md 初始化 2023-11-13 20:36:13 +08:00
composer.json 初始化 2023-11-13 20:36:13 +08:00
phpcs.xml 初始化 2023-11-13 20:36:13 +08:00
physical.info.yml 初始化 2023-11-13 20:36:13 +08:00
physical.libraries.yml 初始化 2023-11-13 20:36:13 +08:00
physical.services.yml 初始化 2023-11-13 20:36:13 +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);