You are here

public function FieldTimerCountyFormatter::settingsSummary in Field Timer 8

Same name and namespace in other branches
  1. 2.x src/Plugin/Field/FieldFormatter/FieldTimerCountyFormatter.php \Drupal\field_timer\Plugin\Field\FieldFormatter\FieldTimerCountyFormatter::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/FieldTimerCountyFormatter.php, line 153

Class

FieldTimerCountyFormatter
Plugin implementation of the 'field_timer_county' formatter.

Namespace

Drupal\field_timer\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = parent::settingsSummary();
  $animation = $this
    ->getSetting('animation');
  $theme = $this
    ->getSetting('theme');
  $reflection = $this
    ->getSetting('reflection');
  $summary[] = $this
    ->t('Animation: @animation', [
    '@animation' => $this
      ->animationOptions()[$animation],
  ]);
  $summary[] = $this
    ->t('Speed: @speed', [
    '@speed' => $this
      ->getSetting('speed') . 'ms',
  ]);
  $summary[] = $this
    ->t('Theme: @theme', [
    '@theme' => $this
      ->themeOptions()[$theme],
  ]);
  $summary[] = $this
    ->t('Background: @css', [
    '@css' => $this
      ->getSetting('background'),
  ]);
  $summary[] = $this
    ->t('Reflection: @state', [
    '@state' => $reflection ? $this
      ->t('Enabled') : $this
      ->t('Disabled'),
  ]);
  if ($reflection) {
    $summary[] = t('Reflection opacity: @opacity', [
      '@opacity' => $this
        ->getSetting('reflectionOpacity'),
    ]);
  }
  return $summary;
}