You are here

public function StringFormatter::settingsSummary in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 108
Contains \Drupal\Core\Field\Plugin\Field\FieldFormatter\StringFormatter.

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->entityManager
      ->getDefinition($this->fieldDefinition
      ->getTargetEntityTypeId());
    $summary[] = $this
      ->t('Linked to the @entity_label', [
      '@entity_label' => $entity_type
        ->getLabel(),
    ]);
  }
  return $summary;
}