You are here

public function FotoramaGalleryFormatter::settingsSummary in Fotorama Gallery 8.2

Same name and namespace in other branches
  1. 8 src/Plugin/Field/FieldFormatter/FotoramaGalleryFormatter.php \Drupal\fotorama_gallery\Plugin\Field\FieldFormatter\FotoramaGalleryFormatter::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/FotoramaGalleryFormatter.php, line 377

Class

FotoramaGalleryFormatter
Plugin implementation of the 'fotorama_gallery display' formatter.

Namespace

Drupal\fotorama_gallery\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = parent::settingsSummary();
  array_unshift($summary, "Fotorama Gallery Settings");
  $dimensions = $this
    ->getSettings()['dimensions'];
  $others = $this
    ->getSettings()['others'];
  $autoplay = $this
    ->getSettings()['autoplay'];
  $navigation = $this
    ->getSettings()['navigation'];
  $transition = $this
    ->getSettings()['transition'];
  if (!empty($dimensions['ratio'])) {
    $summary[] = $this
      ->t('data-ratio: @value', [
      '@value' => $dimensions['ratio'],
    ]);
  }
  if (!empty($dimensions['width'])) {
    $summary[] = $this
      ->t('data-width: @value', [
      '@value' => $dimensions['width'],
    ]);
  }
  if (!empty($dimensions['maxwidth'])) {
    $summary[] = $this
      ->t('data-maxwidth: @value', [
      '@value' => $dimensions['maxwidth'],
    ]);
  }
  if (!empty($dimensions['minwidth'])) {
    $summary[] = $this
      ->t('data-minwidth: @value', [
      '@value' => $dimensions['minwidth'],
    ]);
  }
  if (!empty($dimensions['height'])) {
    $summary[] = $this
      ->t('data-height: @value', [
      '@value' => $dimensions['height'],
    ]);
  }
  if (!empty($dimensions['maxheight'])) {
    $summary[] = $this
      ->t('data-maxheight: @value', [
      '@value' => $dimensions['maxheight'],
    ]);
  }
  if (!empty($dimensions['minheight'])) {
    $summary[] = $this
      ->t('data-minheight: @value', [
      '@value' => $dimensions['minheight'],
    ]);
  }
  $summary[] = $this
    ->t('data-fit: @value', [
    '@value' => $this->fitOptions[$others['fit']],
  ]);
  $summary[] = $this
    ->t('data-allowfullscreen: @value', [
    '@value' => !empty($others['allowfullscreen']) ? $this->allowFullScreenOptions[$others['allowfullscreen']] : 'false',
  ]);
  $summary[] = $this
    ->t('data-loop: @value', [
    '@value' => $others['loop'] ? 'true' : 'false',
  ]);
  $summary[] = $this
    ->t('data-shuffle: @value', [
    '@value' => $others['shuffle'] ? 'true' : 'false',
  ]);
  $summary[] = $this
    ->t('data-keyboard: @value', [
    '@value' => $others['keyboard'] ? 'true' : 'false',
  ]);
  $summary[] = $this
    ->t('data-arrows: @value', [
    '@value' => $this->arrowsOptions[$others['arrows']],
  ]);
  $summary[] = $this
    ->t('data-click: @value', [
    '@value' => $others['click'] ? 'true' : 'false',
  ]);
  $summary[] = $this
    ->t('data-swipe: @value', [
    '@value' => $others['swipe'] ? 'true' : 'false',
  ]);
  $summary[] = $this
    ->t('data-trackpad: @value', [
    '@value' => $others['trackpad'] ? 'true' : 'false',
  ]);
  $summary[] = $this
    ->t('data-stopautoplayontouch: @value', [
    '@value' => $autoplay['stopautoplayontouch'] ? 'true' : 'false',
  ]);
  if (!empty($navigation['nav'])) {
    $summary[] = $this
      ->t('data-nav: @value', [
      '@value' => $this->navOptions[$navigation['nav']],
    ]);
  }
  if (!empty($navigation['navposition'])) {
    $summary[] = $this
      ->t('data-navposition: @value', [
      '@value' => $this->navPositionOptions[$navigation['navposition']],
    ]);
  }
  if (!empty($transition['transition'])) {
    $summary[] = $this
      ->t('data-transition: @value', [
      '@value' => $this->transitionOptions[$transition['transition']],
    ]);
  }
  if (!empty($transition['clicktransition'])) {
    $summary[] = $this
      ->t('data-clicktransition: @value', [
      '@value' => $this->clickTransitionOptions[$transition['clicktransition']],
    ]);
  }
  return $summary;
}