You are here

public function HierarchicalFormatter::settingsSummary in Hierarchical Term 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/HierarchicalFormatter.php, line 183

Class

HierarchicalFormatter
Plugin implementation of the 'rating' formatter.

Namespace

Drupal\hierarchical_term_formatter\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $display_options = $this
    ->displayOptions();
  $order = $this
    ->getSetting('reverse') ? $this
    ->t('Reverse') : $this
    ->t('Natural');
  $summary = [];
  $summary[] = $this
    ->t('Display: %display as %format.', [
    '%display' => $display_options[$this
      ->getSetting('display')],
    '%format' => $this
      ->getSetting('link') ? $this
      ->t('links') : $this
      ->t('plain text'),
  ]);
  $summary[] = $this
    ->t('Wrapper: @wrapper.', [
    '@wrapper' => $this
      ->getSetting('wrap'),
  ]);
  $summary[] = $this
    ->t('Order: %order.', [
    '%order' => $order,
  ]);
  $summary[] = $this
    ->t('Separator: "%separator".', [
    '%separator' => $this
      ->getSetting('separator'),
  ]);
  return $summary;
}