You are here

public function OrbitFormatter::settingsSummary in ZURB Orbit 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 ImageFormatter::settingsSummary

File

src/Plugin/Field/FieldFormatter/OrbitFormatter.php, line 197

Class

OrbitFormatter
Plugin implementation of the 'Orbit' formatter.

Namespace

Drupal\field_orbit\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {

  // Get summary of image_style and image_link from parent method.
  $summary = parent::settingsSummary();
  $caption_types = [
    'title' => $this
      ->t('Title text'),
    'alt' => $this
      ->t('Alt text'),
  ];
  $link_types = [
    'content' => $this
      ->t('Content'),
    'file' => $this
      ->t('File'),
  ];

  // Display this setting only if there's a caption.
  $caption_types_settings = $this
    ->getSetting('caption');
  if (isset($caption_types[$caption_types_settings])) {
    $caption_message = $this
      ->t('Caption: @caption', [
      '@caption' => $caption_types[$caption_types_settings],
    ]);
    $link_types_settings = $this
      ->getSetting('caption_link');
    if (isset($link_types[$link_types_settings])) {
      $caption_message .= ' (' . $this
        ->t('Link to: @link', [
        '@link' => $link_types[$link_types_settings],
      ]) . ')';
    }
    $summary[] = $caption_message;
  }
  $summary[] = $this
    ->t('animInFromLeft: @effect', [
    '@effect' => $this
      ->getSetting('animInFromLeft'),
  ]);
  $summary[] = $this
    ->t('animInFromRight: @effect', [
    '@effect' => $this
      ->getSetting('animInFromRight'),
  ]);
  $summary[] = $this
    ->t('animOutToLeft: @effect', [
    '@effect' => $this
      ->getSetting('animOutToLeft'),
  ]);
  $summary[] = $this
    ->t('animOutToRight: @effect', [
    '@effect' => $this
      ->getSetting('animOutToRight'),
  ]);
  $summary[] = $this
    ->t('Autoplay: @autoplay', [
    '@autoplay' => $this
      ->getSetting('infiniteWrap') ? $this
      ->t('yes') : $this
      ->t('no'),
  ]);
  $summary[] = $this
    ->t('Timer delay: @speedms', [
    '@speed' => $this
      ->getSetting('timerDelay'),
  ]);
  $summary[] = $this
    ->t('Infinite wrap: @wrap', [
    '@wrap' => $this
      ->getSetting('infiniteWrap') ? $this
      ->t('yes') : $this
      ->t('no'),
  ]);
  $summary[] = $this
    ->t('Swipe enabled: @swipe', [
    '@swipe' => $this
      ->getSetting('swipe') ? $this
      ->t('yes') : $this
      ->t('no'),
  ]);
  $summary[] = $this
    ->t('Pause on hover: @pause', [
    '@pause' => $this
      ->getSetting('pauseOnHover') ? $this
      ->t('yes') : $this
      ->t('no'),
  ]);
  $summary[] = $this
    ->t('Keyboard navigation: @accessible', [
    '@accessible' => $this
      ->getSetting('accessible') ? $this
      ->t('yes') : $this
      ->t('no'),
  ]);
  $summary[] = $this
    ->t('bullets: @bullets', [
    '@bullets' => $this
      ->getSetting('bullets') ? $this
      ->t('yes') : $this
      ->t('no'),
  ]);
  $summary[] = $this
    ->t('Navigation buttons: @nav', [
    '@nav' => $this
      ->getSetting('navButtons') ? $this
      ->t('yes') : $this
      ->t('no'),
  ]);
  $summary[] = $this
    ->t('Container class: @class', [
    '@class' => $this
      ->getSetting('containerClass'),
  ]);
  $summary[] = $this
    ->t('Slide class: @class', [
    '@class' => $this
      ->getSetting('slideClass'),
  ]);
  $summary[] = $this
    ->t('Bullets class: @class', [
    '@class' => $this
      ->getSetting('boxOfBullets'),
  ]);
  $summary[] = $this
    ->t('Next class: @class', [
    '@class' => $this
      ->getSetting('nextClass'),
  ]);
  $summary[] = $this
    ->t('Previous class: @class', [
    '@class' => $this
      ->getSetting('nextClass'),
  ]);
  return $summary;
}