You are here

public function FieldWrapperBase::settingsSummary in (Entity Reference) Field Formatters 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/Field/FieldFormatter/FieldWrapperBase.php \Drupal\field_formatter\Plugin\Field\FieldFormatter\FieldWrapperBase::settingsSummary()
  2. 3.x src/Plugin/Field/FieldFormatter/FieldWrapperBase.php \Drupal\field_formatter\Plugin\Field\FieldFormatter\FieldWrapperBase::settingsSummary()

Returns a short summary for the current formatter settings.

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

Return value

string[] A short summary of the formatter settings.

Overrides FormatterBase::settingsSummary

File

src/Plugin/Field/FieldFormatter/FieldWrapperBase.php, line 249

Class

FieldWrapperBase
Wraps an existing field.

Namespace

Drupal\field_formatter\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = parent::settingsSummary();
  if ($type = $this
    ->getSetting('type')) {
    $summary[] = $this
      ->t('Formatter %type used.', [
      '%type' => $type,
    ]);
  }
  else {
    $summary[] = $this
      ->t('Formatter not configured.');
  }
  return $summary;
}