You are here

public function SmartDateCustomFormatter::settingsSummary in Smart Date 3.3.x

Same name and namespace in other branches
  1. 8.2 src/Plugin/Field/FieldFormatter/SmartDateCustomFormatter.php \Drupal\smart_date\Plugin\Field\FieldFormatter\SmartDateCustomFormatter::settingsSummary()
  2. 8 src/Plugin/Field/FieldFormatter/SmartDateCustomFormatter.php \Drupal\smart_date\Plugin\Field\FieldFormatter\SmartDateCustomFormatter::settingsSummary()
  3. 3.x src/Plugin/Field/FieldFormatter/SmartDateCustomFormatter.php \Drupal\smart_date\Plugin\Field\FieldFormatter\SmartDateCustomFormatter::settingsSummary()
  4. 3.0.x src/Plugin/Field/FieldFormatter/SmartDateCustomFormatter.php \Drupal\smart_date\Plugin\Field\FieldFormatter\SmartDateCustomFormatter::settingsSummary()
  5. 3.1.x src/Plugin/Field/FieldFormatter/SmartDateCustomFormatter.php \Drupal\smart_date\Plugin\Field\FieldFormatter\SmartDateCustomFormatter::settingsSummary()
  6. 3.2.x src/Plugin/Field/FieldFormatter/SmartDateCustomFormatter.php \Drupal\smart_date\Plugin\Field\FieldFormatter\SmartDateCustomFormatter::settingsSummary()
  7. 3.4.x src/Plugin/Field/FieldFormatter/SmartDateCustomFormatter.php \Drupal\smart_date\Plugin\Field\FieldFormatter\SmartDateCustomFormatter::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 TimestampFormatter::settingsSummary

File

src/Plugin/Field/FieldFormatter/SmartDateCustomFormatter.php, line 125

Class

SmartDateCustomFormatter
Plugin implementation of the 'Custom' formatter for 'smartdate' fields.

Namespace

Drupal\smart_date\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = parent::settingsSummary();
  if ($separator = $this
    ->getSetting('separator')) {
    $summary[] = $this
      ->t('Separator: %separator', [
      '%separator' => $separator,
    ]);
  }
  if ($join = $this
    ->getSetting('join')) {
    $summary[] = $this
      ->t('Join: %join', [
      '%join' => $join,
    ]);
  }
  if ($time_format = $this
    ->getSetting('time_format')) {
    $summary[] = $this
      ->t('Time Format: %time_format', [
      '%time_format' => $time_format,
    ]);
  }
  if ($date_format = $this
    ->getSetting('date_format')) {
    $summary[] = $this
      ->t('Date Format: %date_format', [
      '%date_format' => $date_format,
    ]);
  }
  return $summary;
}