You are here

public function PhysicalWidgetBase::settingsSummary in Physical Fields 8

Returns a short summary for the current widget settings.

If an empty result is returned, a UI can still be provided to display a settings form in case the widget has configurable settings.

Return value

array A short summary of the widget settings.

Overrides WidgetBase::settingsSummary

File

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

Class

PhysicalWidgetBase
Provides base functionality for physical widgets.

Namespace

Drupal\physical\Plugin\Field\FieldWidget

Code

public function settingsSummary() {
  $summary = [];
  $summary[] = $this
    ->t('Default unit: @unit', [
    '@unit' => $this
      ->getDefaultUnit(),
  ]);
  if (!$this
    ->getSetting('allow_unit_change')) {
    $summary[] = $this
      ->t('User cannot modify the unit of measurement.');
  }
  else {
    $summary[] = $this
      ->t('User can modify the unit of measurement.');
  }
  return $summary;
}