public function AmpImageFormatter::settingsSummary in Accelerated Mobile Pages (AMP) 8.2
Same name and namespace in other branches
- 8.3 src/Plugin/Field/FieldFormatter/AmpImageFormatter.php \Drupal\amp\Plugin\Field\FieldFormatter\AmpImageFormatter::settingsSummary()
- 8 src/Plugin/Field/FieldFormatter/AmpImageFormatter.php \Drupal\amp\Plugin\Field\FieldFormatter\AmpImageFormatter::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 ImageFormatter::settingsSummary
File
- src/
Plugin/ Field/ FieldFormatter/ AmpImageFormatter.php, line 70
Class
- AmpImageFormatter
- Plugin implementation of the 'amp_image' formatter.
Namespace
Drupal\amp\Plugin\Field\FieldFormatterCode
public function settingsSummary() {
$summary = parent::settingsSummary();
// Display this setting only if an AMP layout is set.
$layout_options = $this
->getLayouts();
$layout_setting = $this
->getSetting('amp_layout');
if (isset($layout_options[$layout_setting])) {
$summary[] = t('Layout: @setting', array(
'@setting' => $layout_options[$layout_setting],
));
if ($layout_options[$layout_setting] === 'fixed-height') {
$summary[] = t('Fixed height: @height', array(
'@height' => $this
->getSetting('amp_fixed_height'),
));
}
}
return $summary;
}