You are here

public function AmpVideoFormatter::settingsSummary in Accelerated Mobile Pages (AMP) 8

Same name and namespace in other branches
  1. 8.3 src/Plugin/Field/FieldFormatter/AmpVideoFormatter.php \Drupal\amp\Plugin\Field\FieldFormatter\AmpVideoFormatter::settingsSummary()
  2. 8.2 src/Plugin/Field/FieldFormatter/AmpVideoFormatter.php \Drupal\amp\Plugin\Field\FieldFormatter\AmpVideoFormatter::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 DescriptionAwareFileFormatterBase::settingsSummary

File

src/Plugin/Field/FieldFormatter/AmpVideoFormatter.php, line 64
Contains \Drupal\amp\Plugin\Field\FieldFormatter\AmpVideoFormatter.

Class

AmpVideoFormatter
Plugin implementation of the 'amp_video' formatter.

Namespace

Drupal\amp\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = parent::settingsSummary();
  $height_setting = $this
    ->getSetting('amp_video_height');
  if (isset($height_setting)) {
    $summary[] = t('Height: @height' . 'px', array(
      '@height' => $height_setting,
    ));
  }
  $width_setting = $this
    ->getSetting('amp_video_width');
  if (isset($width_setting)) {
    $summary[] = t('Width: @width' . 'px', array(
      '@width' => $width_setting,
    ));
  }
  return $summary;
}