public function ReadmoreFormatter::settingsSummary in Readmore 8
Same name and namespace in other branches
- 2.x src/Plugin/Field/FieldFormatter/ReadmoreFormatter.php \Drupal\readmore\Plugin\Field\FieldFormatter\ReadmoreFormatter::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/ ReadmoreFormatter.php, line 104 - Contains \Drupal\readmore\Plugin\field\FieldFormatter\ReadmoreFormatter.
Class
- ReadmoreFormatter
- Plugin implementation of the 'readmore' formatter.
Namespace
Drupal\readmore\Plugin\Field\FieldFormatterCode
public function settingsSummary() {
$summary = [];
$settings = $this
->getSettings();
if (!empty($settings['trim_on_break'])) {
$summary[] = $this
->t('Trim on @break', [
'@break' => '<!--break-->',
]);
}
elseif (!empty($settings['trim_length'])) {
$summary[] = $this
->t('Text trimmed to @limit characters', [
'@limit' => $settings['trim_length'],
]);
}
if (!empty($settings['show_readmore'])) {
$summary[] = $this
->t('With read more link');
}
else {
$summary[] = $this
->t('Without read more link');
}
if (!empty($settings['show_readless'])) {
$summary[] = $this
->t('With read less link');
}
else {
$summary[] = $this
->t('Without read less link');
}
if (!empty($settings['ellipsis'])) {
$summary[] = $this
->t('With ellipsis');
}
else {
$summary[] = $this
->t('Without ellipsis');
}
if (!empty($settings['wordsafe'])) {
$summary[] = $this
->t('Truncate on a word boundary');
}
return $summary;
}