You are here

public function DateRangeFormatterRangeFormatter::settingsSummary in Date range formatter 9.0.x

Same name and namespace in other branches
  1. 8.3 src/Plugin/Field/FieldFormatter/DateRangeFormatterRangeFormatter.php \Drupal\date_range_formatter\Plugin\Field\FieldFormatter\DateRangeFormatterRangeFormatter::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 DateTimeCustomFormatter::settingsSummary

File

src/Plugin/Field/FieldFormatter/DateRangeFormatterRangeFormatter.php, line 134

Class

DateRangeFormatterRangeFormatter
Plugin implementation of the 'Custom' formatter for 'daterange' fields.

Namespace

Drupal\date_range_formatter\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = parent::settingsSummary();
  $summary[] = $this
    ->t('Display date range using formats: @single, @single_all_day, @one_day, @one_month, @several_months, @several_years', array(
    '@single' => $this
      ->getSetting('single') ?: 'd F Y',
    '@single_all_day' => $this
      ->getSetting('single_all_day') ?: 'd F Y',
    '@one_day' => $this
      ->getSetting('one_day') ?: 'd F Y',
    '@one_month' => $this
      ->getSetting('one_month') ?: 'd - {d} F Y',
    '@several_months' => $this
      ->getSetting('several_months') ?: 'd F - {d} {F} Y',
    '@several_years' => $this
      ->getSetting('several_years') ?: 'd F Y - {d} {F} {Y}',
  ));
  return $summary;
}