You are here

protected function PhysicalWidgetBase::getUnits in Physical Fields 8

Gets the available units for the current field.

Return value

array The unit labels, keyed by unit.

1 call to PhysicalWidgetBase::getUnits()
PhysicalWidgetBase::settingsForm in src/Plugin/Field/FieldWidget/PhysicalWidgetBase.php
Returns a form to configure settings for the widget.

File

src/Plugin/Field/FieldWidget/PhysicalWidgetBase.php, line 64

Class

PhysicalWidgetBase
Provides base functionality for physical widgets.

Namespace

Drupal\physical\Plugin\Field\FieldWidget

Code

protected function getUnits() {

  /** @var \Drupal\physical\UnitInterface $unit_class */
  $unit_class = $this
    ->getUnitClass();
  return $unit_class::getLabels();
}