public function FileDownloadFieldFormatter::settingsSummary in File Download 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/ FileDownloadFieldFormatter.php, line 87
Class
- FileDownloadFieldFormatter
- Plugin annotation @FieldFormatter( id = "file_download_formatter", label = @Translation("File Download"), field_types = { "file", "image" } )
Namespace
Drupal\file_download\Plugin\Field\FieldFormatterCode
public function settingsSummary() {
$summary = [];
$settings = $this
->getSettings();
$displayOptions = $this
->getDisplayOptions();
$selectedTitleDisplay = $settings['link_title'];
$tArgs = [
'@view' => $displayOptions[$selectedTitleDisplay],
];
$summary[] = $this
->t('Title Display: @view', $tArgs);
if ($selectedTitleDisplay === 'custom') {
$tArgs = [
'@text' => $settings['custom_title_text'],
];
$summary[] = $this
->t('Custom text: @text', $tArgs);
}
return $summary;
}