You are here

public function DateRecurDefaultFormatter::settingsSummary in Recurring Dates Field 8

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 DateRangeDefaultFormatter::settingsSummary

File

src/Plugin/Field/FieldFormatter/DateRecurDefaultFormatter.php, line 86

Class

DateRecurDefaultFormatter
Plugin implementation of the 'date_recur_default_formatter' formatter.

Namespace

Drupal\date_recur\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = parent::settingsSummary();
  $summary[] = $this
    ->t('Show repeat rule') . ': ' . ($this
    ->getSetting('show_rrule') ? $this
    ->t('Yes') : $this
    ->t('No'));
  $summary[] = $this
    ->t('Show next occurrences') . ': ' . $this
    ->showNextOptions()[$this
    ->getSetting('show_next')];
  $date = new DrupalDateTime();
  $date->_dateRecurIsOccurrence = TRUE;
  $summary[] = t('Occurrence format: @display', [
    '@display' => $this
      ->formatDate($date),
  ]);
  return $summary;
}