public function ParagraphsTrimmedFormatterBase::settingsSummary in Paragraphs Trimmed 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 EntityReferenceRevisionsEntityFormatter::settingsSummary
File
- src/
Plugin/ Field/ FieldFormatter/ ParagraphsTrimmedFormatterBase.php, line 135
Class
- ParagraphsTrimmedFormatterBase
- Base class for paragraph trimmed formatters.
Namespace
Drupal\paragraphs_trimmed\Plugin\Field\FieldFormatterCode
public function settingsSummary() {
$summary = parent::settingsSummary();
$text_format = FilterFormat::load($this
->getSetting('format'));
if ($field_name = $this
->getSetting('summary_field')) {
$summary[] = $this
->t('Summary Field: :summary_field', [
':summary_field' => $this
->getSummaryFieldOptions()[$field_name],
]);
}
$summary[] = $this
->t('Text Format: :formatter', [
':formatter' => $text_format
->label(),
]);
$summary = array_merge($summary, $this->formatter
->setSettings($this
->getSettings())
->settingsSummary());
return $summary;
}