public function DateTimeDayDefaultFormatter::settingsSummary in Date time day 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 DateTimeDefaultFormatter::settingsSummary
File
- src/
Plugin/ Field/ FieldFormatter/ DateTimeDayDefaultFormatter.php, line 81
Class
- DateTimeDayDefaultFormatter
- Plugin implementation of the 'Default' formatter for 'datetimeday' fields.
Namespace
Drupal\date_time_day\Plugin\Field\FieldFormatterCode
public function settingsSummary() {
if ($override = $this
->getSetting('timezone_override')) {
$summary[] = $this
->t('Time zone: @timezone', [
'@timezone' => $override,
]);
}
$date = new DrupalDateTime();
$summary[] = t('Day format: @display', [
'@display' => $this
->formatDate($date),
]);
$summary[] = t('Time format: @display', [
'@display' => $this
->formatTime($date),
]);
if ($day_separator = $this
->getSetting('day_separator')) {
$summary[] = $this
->t('Day separator: %day_separator', [
'%day_separator' => $day_separator,
]);
}
if ($time_separator = $this
->getSetting('time_separator')) {
$summary[] = $this
->t('Time separator: %time_separator', [
'%time_separator' => $time_separator,
]);
}
return $summary;
}