You are here

public function DurationHumanDisplayFormatter::settingsSummary in Duration Field 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/Field/FieldFormatter/DurationHumanDisplayFormatter.php \Drupal\duration_field\Plugin\Field\FieldFormatter\DurationHumanDisplayFormatter::settingsSummary()
  2. 3.0.x src/Plugin/Field/FieldFormatter/DurationHumanDisplayFormatter.php \Drupal\duration_field\Plugin\Field\FieldFormatter\DurationHumanDisplayFormatter::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/DurationHumanDisplayFormatter.php, line 87

Class

DurationHumanDisplayFormatter
Provides a formatter for the duration field type.

Namespace

Drupal\duration_field\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = [];
  $settings = $this
    ->getSettings();
  $summary[] = $this
    ->t('Displays the duration in a human-friendly format. Words are shown in @text_length form, and separated by @separator', [
    '@text_length' => $this
      ->getHumanFriendlyLabel($settings['text_length'], FALSE),
    '@separator' => $this
      ->getHumanFriendlyLabel($settings['separator'], FALSE),
  ]);
  return $summary;
}