You are here

public function VotingApiReactionFormatter::settingsSummary in Voting API Reaction 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/VotingApiReactionFormatter.php, line 133

Class

VotingApiReactionFormatter
Plugin implementation of the 'votingapi_reaction_default' formatter.

Namespace

Drupal\votingapi_reaction\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  return [
    $this
      ->t('Reactions summary: @status', [
      '@status' => $this
        ->getSetting('show_summary') ? $this
        ->t('yes') : $this
        ->t('no'),
    ]),
    $this
      ->t('Reaction icon: @status', [
      '@status' => $this
        ->getSetting('show_icon') ? $this
        ->t('yes') : $this
        ->t('no'),
    ]),
    $this
      ->t('Reaction label: @status', [
      '@status' => $this
        ->getSetting('show_label') ? $this
        ->t('yes') : $this
        ->t('no'),
    ]),
    $this
      ->t('Reaction count: @status', [
      '@status' => $this
        ->getSetting('show_count') ? $this
        ->t('yes') : $this
        ->t('no'),
    ]),
    $this
      ->t('Sort reactions: @status', [
      '@status' => $this
        ->getSetting('sort_reactions'),
    ]),
  ];
}