public function RangeFormatterBase::settingsSummary in Range 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 FormatterBase::settingsSummary
File
- src/
Plugin/ Field/ FieldFormatter/ RangeFormatterBase.php, line 87
Class
- RangeFormatterBase
- Parent plugin for decimal and integer range formatters.
Namespace
Drupal\range\Plugin\Field\FieldFormatterCode
public function settingsSummary() {
$summary = [];
$from_value = $this
->formatNumber(1234.123456789);
$to_value = $this
->formatNumber(4321.0987654321);
$summary[] = [
'#theme' => 'range_formatter_range_separate',
'#from' => $from_value,
'#range_separator' => $this
->getSetting('range_separator'),
'#to' => $to_value,
];
if ($this
->getSetting('range_combine')) {
$summary[] = $this
->t('Equivalent values will be combined into a single value.');
}
if ($this
->getSetting('field_prefix_suffix')) {
$summary[] = $this
->t('Display with <em>FIELD value</em> prefix and suffix.');
}
if ($this
->getSetting('from_prefix_suffix')) {
$summary[] = $this
->t('Display with <em>FROM value</em> prefix and suffix.');
}
if ($this
->getSetting('to_prefix_suffix')) {
$summary[] = $this
->t('Display with <em>TO value</em> prefix and suffix.');
}
if ($this
->getSetting('range_combine') && $this
->getSetting('combined_prefix_suffix')) {
$summary[] = $this
->t('Display with <em>COMBINED value</em> prefix and suffix.');
}
return $summary;
}