public function TimestampFormatter::settingsSummary in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/TimestampFormatter.php \Drupal\Core\Field\Plugin\Field\FieldFormatter\TimestampFormatter::settingsSummary()
- 9 core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/TimestampFormatter.php \Drupal\Core\Field\Plugin\Field\FieldFormatter\TimestampFormatter::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 FormatterBase::settingsSummary
File
- core/
lib/ Drupal/ Core/ Field/ Plugin/ Field/ FieldFormatter/ TimestampFormatter.php, line 144
Class
- TimestampFormatter
- Plugin implementation of the 'timestamp' formatter.
Namespace
Drupal\Core\Field\Plugin\Field\FieldFormatterCode
public function settingsSummary() {
$summary = parent::settingsSummary();
$date_format = $this
->getSetting('date_format');
$summary[] = $this
->t('Date format: @date_format', [
'@date_format' => $date_format,
]);
if ($this
->getSetting('date_format') === 'custom' && ($custom_date_format = $this
->getSetting('custom_date_format'))) {
$summary[] = $this
->t('Custom date format: @custom_date_format', [
'@custom_date_format' => $custom_date_format,
]);
}
if ($timezone = $this
->getSetting('timezone')) {
$summary[] = $this
->t('Time zone: @timezone', [
'@timezone' => $timezone,
]);
}
return $summary;
}