public function SwaggerUIFormatter::settingsSummary in Swagger UI Field Formatter 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/ SwaggerUIFormatter.php, line 110
Class
- SwaggerUIFormatter
- Plugin implementation of the 'swagger_ui' formatter.
Namespace
Drupal\swagger_ui_formatter\Plugin\Field\FieldFormatterCode
public function settingsSummary() {
$summary = parent::settingsSummary();
$supported_submit_methods = array_filter($this
->getSetting('supported_submit_methods'));
$summary[] = $this
->t('Uses %validator validator, Doc Expansion of %doc_expansion, Shows top bar: %show_top_bar, Tags sorted by name: %sort_tags_by_name, Try it out support for HTTP Methods: %supported_submit_methods.', [
'%validator' => $this
->getSetting('validator'),
'%doc_expansion' => $this
->getSetting('doc_expansion'),
'%show_top_bar' => $this
->getSetting('show_top_bar') ? $this
->t('Yes') : $this
->t('No'),
'%sort_tags_by_name' => $this
->getSetting('sort_tags_by_name') ? $this
->t('Yes') : $this
->t('No'),
'%supported_submit_methods' => !empty($supported_submit_methods) ? implode(', ', array_map('strtoupper', $supported_submit_methods)) : $this
->t('None'),
]);
return $summary;
}