You are here

public function MinisiteFormatter::settingsSummary in Mini site 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 DescriptionAwareFileFormatterBase::settingsSummary

File

src/Plugin/Field/FieldFormatter/MinisiteFormatter.php, line 66

Class

MinisiteFormatter
Plugin implementation of the 'minisite' formatter.

Namespace

Drupal\minisite\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = [];
  $link_types = [
    self::LINK_TO_CONTENT => $this
      ->t('Link to Content'),
    self::LINK_TO_FILE => $this
      ->t('Link to File'),
  ];

  // Display this setting only if minisite is linked.
  $minisite_link_setting = $this
    ->getSetting('minisite_link');
  if (isset($link_types[$minisite_link_setting])) {
    $summary[] = $link_types[$minisite_link_setting];
  }
  return $summary;
}