You are here

public function SocialPrivateMessageMemberFormatter::settingsSummary in Open Social 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

modules/social_features/social_private_message/src/Plugin/Field/Fieldformatter/SocialPrivateMessageMemberFormatter.php, line 101

Class

SocialPrivateMessageMemberFormatter
Class SocialPrivateMessageMemberFormatter.

Namespace

Drupal\social_private_message\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = [];
  $settings = $this
    ->getSettings();
  if ($this
    ->getSetting('display_type') == 'label') {
    $format = 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 = t('Displays members using the %display_mode display mode of the user entity', [
      '%display_mode' => $this
        ->getSetting('entity_display_mode'),
    ]);
  }
  $summary[] = $format;
  return $summary;
}