You are here

public static function LengthUnit::getLabels in Physical Fields 8

Gets the labels for the defined units.

Return value

array An array of labels keyed by unit.

Overrides UnitInterface::getLabels

2 calls to LengthUnit::getLabels()
Dimensions::processElement in src/Element/Dimensions.php
Builds the physical_dimensions form element.
DimensionsDefaultFormatter::viewElements in src/Plugin/Field/FieldFormatter/DimensionsDefaultFormatter.php
Builds a renderable array for a field value.

File

src/LengthUnit.php, line 21

Class

LengthUnit
Provides length units.

Namespace

Drupal\physical

Code

public static function getLabels() {
  return [
    self::MILLIMETER => t('mm'),
    self::CENTIMETER => t('cm'),
    self::METER => t('m'),
    self::KILOMETER => t('km'),
    self::INCH => t('in'),
    self::FOOT => t('ft'),
    self::NAUTICAL_MILE => t('M'),
  ];
}