You are here

public function EntityClassFormatter::settingsSummary in Entity Class Formatter 8

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/EntityClassFormatter.php, line 71

Class

EntityClassFormatter
Plugin implementation of the 'entity_class_formatter'.

Namespace

Drupal\entity_class_formatter\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = parent::settingsSummary();
  $prefix = $this
    ->getSetting('prefix');
  if (!empty($prefix)) {
    $summary[] = $this
      ->t('Prefix: "@prefix"', [
      '@prefix' => $prefix,
    ]);
  }
  $suffix = $this
    ->getSetting('suffix');
  if (!empty($suffix)) {
    $summary[] = $this
      ->t('Suffix: "@suffix".', [
      '@suffix' => $suffix,
    ]);
  }
  $attr = $this
    ->getSetting('attr');
  if (!empty($attr)) {
    $summary[] = $this
      ->t('Attribute: "@attr".', [
      '@attr' => $attr,
    ]);
  }
  return $summary;
}