You are here

public function FFTFormatter::settingsSummary in Field Formatter Template 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/Field/FieldFormatter/FFTFormatter.php \Drupal\fft\Plugin\Field\FieldFormatter\FFTFormatter::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/FFTFormatter.php, line 136

Class

FFTFormatter
Plugin implementation of the 'fft_formatter' formatter.

Namespace

Drupal\fft\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = [];
  $summary[] = $this
    ->t('Formatter Template');
  if ($this
    ->getSetting('template') != '') {
    $fft_template = fft_get_templates('fft');
    if (!empty($fft_template['templates'])) {
      foreach ($fft_template['templates'] as $name => $title) {
        if ($this
          ->getSetting('template') == $name) {
          $summary = [];
          $summary[] = $this
            ->t('Formatter Template: @template', [
            '@template' => $title,
          ]);
          break;
        }
      }
    }
  }
  return $summary;
}