public function ColorboxFieldFormatter::settingsSummary in Colorbox field formatter 8
Same name and namespace in other branches
- 2.0.x src/Plugin/Field/FieldFormatter/ColorboxFieldFormatter.php \Drupal\colorbox_field_formatter\Plugin\Field\FieldFormatter\ColorboxFieldFormatter::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 call to ColorboxFieldFormatter::settingsSummary()
- ColorboxFieldFormatterImage::settingsSummary in src/
Plugin/ Field/ FieldFormatter/ ColorboxFieldFormatterImage.php - Returns a short summary for the current formatter settings.
1 method overrides ColorboxFieldFormatter::settingsSummary()
- ColorboxFieldFormatterImage::settingsSummary in src/
Plugin/ Field/ FieldFormatter/ ColorboxFieldFormatterImage.php - Returns a short summary for the current formatter settings.
File
- src/
Plugin/ Field/ FieldFormatter/ ColorboxFieldFormatter.php, line 211
Class
- ColorboxFieldFormatter
- Plugin implementation of the 'colorbox_field_formatter' formatter.
Namespace
Drupal\colorbox_field_formatter\Plugin\Field\FieldFormatterCode
public function settingsSummary() {
$summary = [];
$styles = $this
->getStyles();
$summary[] = $this
->t('Style: @style', [
'@style' => $styles[$this
->getSetting('style')],
]);
if ($this
->getSetting('style') === 'default') {
$types = $this
->getLinkTypes();
if ($this
->getSetting('link_type') === 'manual') {
$summary[] = $this
->t('Link to @link', [
'@link' => $this
->getSetting('link'),
]);
}
else {
$summary[] = $this
->t('Link to @link', [
'@link' => $types[$this
->getSetting('link_type')],
]);
}
}
if ($this
->getSetting('style') === 'colorbox-inline') {
$summary[] = $this
->t('Inline selector: @selector', [
'@selector' => $this
->getSetting('inline_selector'),
]);
}
$summary[] = $this
->t('Width: @width', [
'@width' => $this
->getSetting('width'),
]);
$summary[] = $this
->t('Height: @height', [
'@height' => $this
->getSetting('height'),
]);
$summary[] = $this
->t('iFrame Mode: @mode', [
'@mode' => $this
->getSetting('iframe') ? $this
->t('Yes') : $this
->t('No'),
]);
if (!empty($this
->getSetting('anchor'))) {
$summary[] = $this
->t('Anchor: #@anchor', [
'@anchor' => $this
->getSetting('anchor'),
]);
}
if (!empty($this
->getSetting('class'))) {
$summary[] = $this
->t('Classes: @class', [
'@class' => $this
->getSetting('class'),
]);
}
if (!empty($this
->getSetting('rel'))) {
$summary[] = $this
->t('Rel: @rel', [
'@rel' => $this
->getSetting('rel'),
]);
}
return $summary;
}