You are here

public function InteractiveLinkFormatter::settingsSummary in Facebook Instant Articles 3.x

Same name and namespace in other branches
  1. 8.2 src/Plugin/Field/FieldFormatter/InteractiveLinkFormatter.php \Drupal\fb_instant_articles\Plugin\Field\FieldFormatter\InteractiveLinkFormatter::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 InteractiveFormatter::settingsSummary

File

src/Plugin/Field/FieldFormatter/InteractiveLinkFormatter.php, line 43

Class

InteractiveLinkFormatter
Plugin implementation of the 'fbia_interactive_link' formatter.

Namespace

Drupal\fb_instant_articles\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = [];
  if ($width = $this
    ->getSetting('width')) {
    $summary[] = $this
      ->t('Width: @width', [
      '@width' => $width,
    ]);
  }
  if ($height = $this
    ->getSetting('height')) {
    $summary[] = $this
      ->t('Height: @height', [
      '@height' => $height,
    ]);
  }
  $margin = $this
    ->getSetting('margin');
  $summary[] = $this
    ->t('Margin setting: @margin', [
    '@margin' => $margin === Interactive::NO_MARGIN ? $this
      ->t('No margin') : $this
      ->t('Column width'),
  ]);
  return $summary;
}