You are here

public function StringFormatter::settingsSummary in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/StringFormatter.php \Drupal\Core\Field\Plugin\Field\FieldFormatter\StringFormatter::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

1 call to StringFormatter::settingsSummary()
LanguageFormatter::settingsSummary in core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/LanguageFormatter.php
Returns a short summary for the current formatter settings.
1 method overrides StringFormatter::settingsSummary()
LanguageFormatter::settingsSummary in core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/LanguageFormatter.php
Returns a short summary for the current formatter settings.

File

core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/StringFormatter.php, line 111

Class

StringFormatter
Plugin implementation of the 'string' formatter.

Namespace

Drupal\Core\Field\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = [];
  if ($this
    ->getSetting('link_to_entity')) {
    $entity_type = $this->entityTypeManager
      ->getDefinition($this->fieldDefinition
      ->getTargetEntityTypeId());
    $summary[] = $this
      ->t('Linked to the @entity_label', [
      '@entity_label' => $entity_type
        ->getLabel(),
    ]);
  }
  return $summary;
}