public function DurationHumanDisplayFormatter::settingsSummary in Duration Field 8.2
Same name and namespace in other branches
- 8 src/Plugin/Field/FieldFormatter/DurationHumanDisplayFormatter.php \Drupal\duration_field\Plugin\Field\FieldFormatter\DurationHumanDisplayFormatter::settingsSummary()
- 3.0.x src/Plugin/Field/FieldFormatter/DurationHumanDisplayFormatter.php \Drupal\duration_field\Plugin\Field\FieldFormatter\DurationHumanDisplayFormatter::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
- src/
Plugin/ Field/ FieldFormatter/ DurationHumanDisplayFormatter.php, line 113
Class
- DurationHumanDisplayFormatter
- Provides a human friendly formatter for the Duration field type.
Namespace
Drupal\duration_field\Plugin\Field\FieldFormatterCode
public function settingsSummary() {
$summary = [];
$settings = $this
->getSettings();
$summary['summary'] = $this
->t('Displays the duration in a human-friendly format');
$summary['text_length'] = $this
->t('Format: @text_length', [
'@text_length' => $this
->getHumanFriendlyLabel($settings['text_length'], FALSE),
]);
$summary['separator'] = $this
->t('Separator: @separator', [
'@separator' => $this
->getHumanFriendlyLabel($settings['separator'], FALSE),
]);
return $summary;
}