You are here

protected function MeasurementDefaultWidget::getUnitClass in Physical Fields 8

Gets the unit class for the current field.

Return value

string The fully qualified class name.

Overrides PhysicalWidgetBase::getUnitClass

File

src/Plugin/Field/FieldWidget/MeasurementDefaultWidget.php, line 48

Class

MeasurementDefaultWidget
Plugin implementation of the 'physical_measurement_default' widget.

Namespace

Drupal\physical\Plugin\Field\FieldWidget

Code

protected function getUnitClass() {
  $measurement_type = $this->fieldDefinition
    ->getSetting('measurement_type');
  return MeasurementType::getUnitClass($measurement_type);
}