You are here

public function FieldTimerCountdownLedFormatter::settingsSummary in Field Timer 8

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

Class

FieldTimerCountdownLedFormatter
Plugin implementation of the 'field_timer_countdown' formatter.

Namespace

Drupal\field_timer\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = parent::settingsSummary();
  $theme = $this
    ->getSetting('countdown_theme');
  $max_count_of_days = $this
    ->getSetting('max_count_of_days');
  $summary[] = t('Theme: %theme', [
    '%theme' => $this
      ->themeOptions()[$theme],
  ]);
  $summary[] = t('Display days: %display_days', [
    '%display_days' => $this
      ->getSetting('display_days') ? $this
      ->t('Yes') : $this
      ->t('No'),
  ]);
  if ($this
    ->getSetting('display_days')) {
    $summary[] = t('Maximum count of days: %max_count_of_days', [
      '%max_count_of_days' => $this
        ->dayOptions()[$max_count_of_days],
    ]);
  }
  $summary[] = t('Display hours: %display_hours', [
    '%display_hours' => $this
      ->getSetting('display_hours') ? $this
      ->t('Yes') : $this
      ->t('No'),
  ]);
  $summary[] = t('Display minutes: %display_minutes', [
    '%display_minutes' => $this
      ->getSetting('display_minutes') ? $this
      ->t('Yes') : $this
      ->t('No'),
  ]);
  $summary[] = t('Display seconds: %display_seconds', [
    '%display_seconds' => $this
      ->getSetting('display_seconds') ? $this
      ->t('Yes') : $this
      ->t('No'),
  ]);
  return $summary;
}