You are here

public function TitleStyleTextFieldFormatter::settingsSummary in Title Field for Manage Display 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/Field/FieldFormatter/TitleStyleTextFieldFormatter.php \Drupal\title_field_for_manage_display\Plugin\Field\FieldFormatter\TitleStyleTextFieldFormatter::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/TitleStyleTextFieldFormatter.php, line 101

Class

TitleStyleTextFieldFormatter
Plugin implementation of the 'title_style_text_field_formatter' formatter.

Namespace

Drupal\title_field_for_manage_display\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $settings = $this
    ->getSettings();
  $replacements = [
    '@tag' => $settings['tag'],
  ];
  if ($settings['linked']) {
    $summary[] = $this
      ->t('Display as @tag, linked to content', $replacements);
  }
  else {
    $summary[] = $this
      ->t('Display as @tag', $replacements);
  }
  if (!empty($settings['classes'])) {
    $summary[] = $this
      ->t('Classes: @classes', [
      '@classes' => $settings['classes'],
    ]);
  }
  return $summary;
}