public function CommentDefaultFormatter::settingsSummary in Drupal 10
Same name and namespace in other branches
- 8 core/modules/comment/src/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php \Drupal\comment\Plugin\Field\FieldFormatter\CommentDefaultFormatter::settingsSummary()
- 9 core/modules/comment/src/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php \Drupal\comment\Plugin\Field\FieldFormatter\CommentDefaultFormatter::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/
modules/ comment/ src/ Plugin/ Field/ FieldFormatter/ CommentDefaultFormatter.php, line 251
Class
- CommentDefaultFormatter
- Provides a default comment formatter.
Namespace
Drupal\comment\Plugin\Field\FieldFormatterCode
public function settingsSummary() {
$view_mode = $this
->getSetting('view_mode');
$view_modes = $this
->getViewModes();
$view_mode_label = $view_modes[$view_mode] ?? 'default';
$summary = [
$this
->t('Comment view mode: @mode', [
'@mode' => $view_mode_label,
]),
];
if ($pager_id = $this
->getSetting('pager_id')) {
$summary[] = $this
->t('Pager ID: @id', [
'@id' => $pager_id,
]);
}
return $summary;
}