public function ImagefieldSlideshowFieldFormatter::settingsSummary in Imagefield Slideshow 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
- src/
Plugin/ Field/ FieldFormatter/ ImagefieldSlideshowFieldFormatter.php, line 226
Class
- ImagefieldSlideshowFieldFormatter
- Plugin implementation of 'imagefield_slideshow_field_formatter' formatter.
Namespace
Drupal\imagefield_slideshow\Plugin\Field\FieldFormatterCode
public function settingsSummary() {
$summary = [];
// Implement settings summary.
$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.
$image_style_setting = $this
->getSetting('imagefield_slideshow_style');
if (isset($image_styles[$image_style_setting])) {
$summary[] = t("Image style: @style", [
'@style' => $image_styles[$image_style_setting],
]);
}
else {
$summary[] = $this
->t("Original image");
}
$image_style_effect = $this
->getSetting('imagefield_slideshow_style_effects');
if (isset($image_style_effect)) {
$summary[] .= $this
->t("Effect: @image_style_effect", [
"@image_style_effect" => $image_style_effect,
]);
}
$image_style_pause = $this
->getSetting('imagefield_slideshow_style_pause');
if (!empty($image_style_pause)) {
$summary[] .= $this
->t("Pause: @image_style_pause", [
"@image_style_pause" => $image_style_pause,
]);
}
$image_prev_next = $this
->getSetting('imagefield_slideshow_prev_next');
if ($image_prev_next) {
$summary[] .= $this
->t("Prev & Next: @image_prev_next", [
"@image_prev_next" => $image_prev_next,
]);
}
$image_transition_speed = $this
->getSetting('imagefield_slideshow_transition_speed');
if ($image_transition_speed) {
$summary[] .= $this
->t("Transition Speed: @image_transition_speed fx", [
"@image_transition_speed" => $image_transition_speed,
]);
}
$image_slideshow_timeout = $this
->getSetting('imagefield_slideshow_timeout');
if ($image_slideshow_timeout) {
$summary[] .= $this
->t("Timeout: @image_slideshow_timeout", [
"@image_slideshow_timeout" => $image_slideshow_timeout,
]);
}
$image_pager = $this
->getSetting('imagefield_slideshow_pager');
if ($image_pager) {
$summary[] .= $this
->t("Pager: @image_pager", [
"@image_pager" => $image_pager,
]);
}
return $summary;
}