You are here

public function SubmittedFormatter::settingsSummary in Manage display 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/SubmittedFormatter.php, line 103

Class

SubmittedFormatter
A field formatter for entity titles.

Namespace

Drupal\manage_display\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = [];
  if ($view_mode = $this
    ->getSetting('user_picture')) {
    $view_modes = $this->entityDisplayRepository
      ->getViewModeOptions($this
      ->getFieldSetting('target_type'));
    $summary[] = $this
      ->t('User picture view mode: @mode', [
      '@mode' => $view_modes[$view_mode] ?? $view_mode,
    ]);
  }
  else {
    $summary[] = $this
      ->t('No user picture');
  }
  return $summary;
}