You are here

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

Same name and namespace in other branches
  1. 8.2 src/Plugin/Field/FieldFormatter/AdFormatter.php \Drupal\fb_instant_articles\Plugin\Field\FieldFormatter\AdFormatter::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 AdFormatter::settingsSummary()
AdLinkFormatter::settingsSummary in src/Plugin/Field/FieldFormatter/AdLinkFormatter.php
Returns a short summary for the current formatter settings.

File

src/Plugin/Field/FieldFormatter/AdFormatter.php, line 71

Class

AdFormatter
Plugin implementation of the 'fbia_ad' 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,
    ]);
  }
  return $summary;
}