public function PrivateMessageThreadMemberFormatter::settingsSummary in Private Message 8
Same name and namespace in other branches
- 8.2 src/Plugin/Field/FieldFormatter/PrivateMessageThreadMemberFormatter.php \Drupal\private_message\Plugin\Field\FieldFormatter\PrivateMessageThreadMemberFormatter::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/ PrivateMessageThreadMemberFormatter.php, line 109
Class
- PrivateMessageThreadMemberFormatter
- Defines the private message member field formatter.
Namespace
Drupal\private_message\Plugin\Field\FieldFormatterCode
public function settingsSummary() {
$summary = [];
if ($this
->getSetting('display_type') == 'label') {
$format = $this
->t('Displays members using their username, linked to the user account if the viewer has permission to access user profiles');
}
elseif ($this
->getSetting('display_type') == 'entity') {
$format = $this
->t('Displays members using the %display_mode display mode of the user entity', [
'%display_mode' => $this
->getSetting('entity_display_mode'),
]);
}
$summary['format'] = $format;
$members_prefix = $this
->getSetting('members_prefix');
if (empty($members_prefix)) {
$summary['field_prefix'] = $this
->t('The members list is shown without a prefix');
}
else {
$summary['field_prefix'] = $this
->t('The members list is prefixed with the text: %members_prefix.', [
'%members_prefix' => $members_prefix,
]);
}
return $summary;
}