You are here

public function PrivateMessageThreadMessageFormatter::settingsSummary in Private Message 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/Field/FieldFormatter/PrivateMessageThreadMessageFormatter.php \Drupal\private_message\Plugin\Field\FieldFormatter\PrivateMessageThreadMessageFormatter::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/PrivateMessageThreadMessageFormatter.php, line 141

Class

PrivateMessageThreadMessageFormatter
Defines the private message thread message field formatter.

Namespace

Drupal\private_message\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = [];
  $settings = $this
    ->getSettings();
  $summary[] = $this
    ->t('Number of threads to show on load: @count', [
    '@count' => $settings['message_count'],
  ]);
  $summary[] = $this
    ->t('Number of threads to show when clicking load previous: @count', [
    '@count' => $settings['ajax_previous_load_count'],
  ]);
  $summary[] = $this
    ->t('Order of messages: @order', [
    '@order' => $this
      ->translateKey('order', $settings['message_order']),
  ]);
  if ($settings['ajax_refresh_rate']) {
    $summary[] = $this
      ->t('Ajax refresh rate: @count seconds', [
      '@count' => $settings['ajax_refresh_rate'],
    ]);
  }
  else {
    $summary[] = $this
      ->t('Ajax refresh rate: Ajax refresh disabled');
  }
  return $summary;
}