public function VotingApiFormatter::settingsSummary in Votingapi Widgets 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/ VotingApiFormatter.php, line 150
Class
- VotingApiFormatter
- Plugin implementation of the 'voting_api_formatter' formatter.
Namespace
Drupal\votingapi_widgets\Plugin\Field\FieldFormatterCode
public function settingsSummary() {
$summary = [];
$summary[] = $this
->t('Styles: @styles', [
'@styles' => $this
->getSetting('style'),
]);
$summary[] = $this
->t('Readonly: @readonly', [
'@readonly' => $this
->getSetting('readonly') ? $this
->t('yes') : $this
->t('no'),
]);
$summary[] = $this
->t('Show results: @results', [
'@results' => $this
->getSetting('show_results') ? $this
->t('yes') : $this
->t('no'),
]);
$summary[] = $this
->t('Show own vote: @show_own_vote', [
'@show_own_vote' => $this
->getSetting('show_own_vote') ? $this
->t('yes') : $this
->t('no'),
]);
return $summary;
}