public function FileShadowboxFormatter::settingsSummary in Shadowbox 8
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
File
- file_shadowbox/
lib/ Drupal/ file_shadowbox/ Plugin/ Field/ FieldFormatter/ FileShadowboxFormatter.php, line 139 - Contains \Drupal\file_shadowbox\Plugin\field\formatter\FileShadowboxFormatter.
Class
- FileShadowboxFormatter
- Plugin implementation of the 'file_shadowbox' formatter.
Namespace
Drupal\file_shadowbox\Plugin\Field\FieldFormatterCode
public function settingsSummary() {
$summary = array();
$settings = $this
->getSettings();
$image_styles = image_style_options(FALSE);
// Unset possible 'No defined styles' option.
unset($image_styles['']);
// Styles could be lost because of enabled/disabled modules that defines
// their styles in code.
if (isset($image_styles[$settings['image_style']])) {
$summary[] = t('Image style: @style', array(
'@style' => $image_styles[$settings['image_style']],
));
}
else {
$summary[] = t('Original image');
}
if (isset($image_styles[$settings['image_link']])) {
$summary[] = t('Linked to: @style', array(
'@style' => $image_styles[$settings['image_link']],
));
}
else {
$summary[] = t('Linked to: Original image');
}
$gallery_options = array(
'page' => 'gallery page',
'field' => 'gallery field page',
'nid' => 'gallery entity',
'field_nid' => 'gallery field entity',
);
if (isset($gallery_options[$settings['gallery']])) {
$summary[] = t('as @gallery', array(
'@gallery' => (isset($settings['compact']) && $settings['compact'] ? 'compact ' : '') . $gallery_options[$settings['gallery']],
));
}
$title_options = array(
'node' => 'node title',
'description' => 'file description',
);
if (isset($title_options[$settings['title']])) {
$summary[] = t('with @title as caption', array(
'@title' => $title_options[$settings['title']],
));
}
$summary[] = t('video width: @width px, video height: @height px', array(
'@width' => $settings['video_width'],
'@height' => $settings['video_height'],
));
$summary[] = t('video thumbnail size: @size px', array(
'@size' => $settings['video_thumb'],
));
return $summary;
}