You are here

public function RadioactivityReferenceEmitter::settingsSummary in Radioactivity 4.0.x

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/RadioactivityReferenceEmitter.php, line 61

Class

RadioactivityReferenceEmitter
Plugin implementation of the 'radioactivity_reference_emitter' formatter.

Namespace

Drupal\radioactivity\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = [];
  $summary[] = t('Emit: @energy', [
    '@energy' => $this
      ->getSetting('energy'),
  ]);
  switch ($this
    ->getSetting('display')) {
    case 'none':
      $summary[] = $this
        ->t('Only emit');
      break;
    case 'raw':
      $summary[] = $this
        ->t('Display energy level');
      break;
  }
  return $summary;
}