You are here

public function JCarouselFormatter::settingsSummary in jCarousel 8.4

Same name and namespace in other branches
  1. 8.5 src/Plugin/Field/FieldFormatter/JCarouselFormatter.php \Drupal\jcarousel\Plugin\Field\FieldFormatter\JCarouselFormatter::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/JCarouselFormatter.php, line 214
Contains \Drupal\jcarousel\Plugin\Field\FieldFormatter\JCarouselFormatter.

Class

JCarouselFormatter
Plugin implementation of the 'jCarousel' formatter.

Namespace

Drupal\jcarousel\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = parent::settingsSummary();
  $wrap = $this
    ->getSetting('wrap');
  if ($wrap != 0) {
    $summary[] = t('Wrap content: @wrap', [
      '@wrap' => Unicode::ucfirst($wrap),
    ]);
  }
  $skin = $this
    ->getSetting('skin');
  $skin_name = t('None');
  if (!empty($skin)) {
    $skins = $this
      ->getSkins();
    $skin_name = isset($skins[$skin]) ? $skins[$skin]['label'] : t('Broken skin !skin', [
      '!skin' => $skin,
    ]);
  }
  $summary[] = t('Skin: @skin', [
    '@skin' => $skin_name,
  ]);
  $responsive = $this
    ->getSetting('responsive');
  if ($responsive != 0) {
    $summary[] = t('Responsive (number of items): @responsive', [
      '@responsive' => $responsive,
    ]);
  }
  $visible = $this
    ->getSetting('visible');
  $visible_name = empty($visible) ? t('Auto') : $visible;
  $summary[] = t('Number of visible items: @visible', [
    '@visible' => $visible_name,
  ]);
  $scroll = $this
    ->getSetting('scroll');
  $scroll_name = empty($visible) ? t('All visible') : $scroll;
  $summary[] = t('Number of items to scroll at a time: @scroll', [
    '@scroll' => $scroll_name,
  ]);
  $auto = $this
    ->getSetting('auto');
  if (!empty($auto)) {
    $summary[] = t('Auto-scroll after @auto seconds', [
      '@auto' => $auto,
    ]);
    $auto_pause = $this
      ->getSetting('autoPause');
    $auto_pause_name = $auto_pause == TRUE ? t('Yes') : t('No');
    $summary[] = t('Pause auto-scroll on hover: @auto_pause', [
      '@auto_pause' => $auto_pause_name,
    ]);
  }
  $navigation = $this
    ->getSetting('navigation');
  $navigation_name = empty($navigation) ? t('Disabled') : Unicode::ucfirst($navigation);
  $summary[] = t('Navigation: @navigation', [
    '@navigation' => $navigation_name,
  ]);
  $animation = $this
    ->getSetting('animation');
  if (!empty($animation)) {
    if (is_int($animation)) {
      $summary[] = t('Navigation: @animation seconds', [
        '@animation' => $animation,
      ]);
    }
    else {
      $summary[] = t('Navigation: @animation', [
        '@animation' => $animation,
      ]);
    }
  }
  $easing = $this
    ->getSetting('easing');
  if (!empty($easing)) {
    $summary[] = t('Easing effect: @easing', [
      '@easing' => $easing,
    ]);
  }
  $start = $this
    ->getSetting('start');
  $summary[] = t('Start position: @start', [
    '@start' => $start,
  ]);
  $vertical = $this
    ->getSetting('vertical');
  if ($vertical == TRUE) {
    $summary[] = t('Vertical: Yes');
  }
  return $summary;
}