You are here

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

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

1 method overrides InteractiveFormatter::settingsSummary()
InteractiveLinkFormatter::settingsSummary in src/Plugin/Field/FieldFormatter/InteractiveLinkFormatter.php
Returns a short summary for the current formatter settings.

File

src/Plugin/Field/FieldFormatter/InteractiveFormatter.php, line 80

Class

InteractiveFormatter
Plugin implementation of the 'fbia_interactive' formatter.

Namespace

Drupal\fb_instant_articles\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = [];
  if ($source_type = $this
    ->getSetting('source_type')) {
    $summary[] = $source_type === self::SOURCE_TYPE_URL ? $this
      ->t('URL') : $this
      ->t('Embedded HTML');
  }
  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;
}