You are here

public function FieldTimerCountdownFormatter::settingsSummary in Field Timer 2.x

Same name and namespace in other branches
  1. 8 src/Plugin/Field/FieldFormatter/FieldTimerCountdownFormatter.php \Drupal\field_timer\Plugin\Field\FieldFormatter\FieldTimerCountdownFormatter::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 FieldTimerCountdownFormatterBase::settingsSummary

File

src/Plugin/Field/FieldFormatter/FieldTimerCountdownFormatter.php, line 191

Class

FieldTimerCountdownFormatter
Plugin implementation of the 'field_timer_countdown' formatter.

Namespace

Drupal\field_timer\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = parent::settingsSummary();
  $useSystemLanguage = $this
    ->getSetting('use_system_language');
  $summary[] = $this
    ->t('Use system language: %use_system_language', [
    '%use_system_language' => $useSystemLanguage ? $this
      ->t('Yes') : $this
      ->t('No'),
  ]);
  if (!$useSystemLanguage) {
    $language = $this
      ->getSetting('regional');
    $summary[] = $this
      ->t('Language: %language', [
      '%language' => $this
        ->languageOptions()[$language],
    ]);
  }
  $summary[] = $this
    ->t('Format: %format', [
    '%format' => $this
      ->getSetting('format'),
  ]);
  $summary[] = $this
    ->t('Layout: %layout', [
    '%layout' => $this
      ->getSetting('layout'),
  ]);
  $summary[] = $this
    ->t('Compact: %compact', [
    '%compact' => $this
      ->getSetting('compact') ? $this
      ->t('Yes') : $this
      ->t('No'),
  ]);
  $summary[] = $this
    ->t('Granularity: %significant', [
    '%significant' => $this
      ->getSetting('significant'),
  ]);
  $summary[] = $this
    ->t('Time separator: %timeSeparator', [
    '%timeSeparator' => $this
      ->getSetting('timeSeparator'),
  ]);
  $summary[] = $this
    ->t('Pad with zeroes: %padZeroes', [
    '%padZeroes' => $this
      ->getSetting('padZeroes') ? $this
      ->t('Yes') : $this
      ->t('No'),
  ]);
  return $summary;
}