You are here

private function FotoramaGalleryFormatter::getNumberFieldsValuePercent in Fotorama Gallery 8

Get the correct format of the field value.

Parameters

string $field_key: Key of the field.

string $field_percent: Key of the field.

Return value

string Value of the field with the correct format.

2 calls to FotoramaGalleryFormatter::getNumberFieldsValuePercent()
FotoramaGalleryFormatter::settingsSummaryNumberFields in src/Plugin/Field/FieldFormatter/FotoramaGalleryFormatter.php
Construct the summary for each dimension field.
FotoramaGalleryFormatter::viewElementsNumberFields in src/Plugin/Field/FieldFormatter/FotoramaGalleryFormatter.php
Get the value for each dimension field.

File

src/Plugin/Field/FieldFormatter/FotoramaGalleryFormatter.php, line 449

Class

FotoramaGalleryFormatter
Plugin implementation of the 'fotorama_gallery display' formatter.

Namespace

Drupal\fotorama_gallery\Plugin\Field\FieldFormatter

Code

private function getNumberFieldsValuePercent($field_key, $field_percent) {
  $value = $this
    ->getSetting('dimensions')[$field_key];
  if (array_key_exists($field_percent, $this
    ->getSetting('dimensions')) && $this
    ->getSetting('dimensions')[$field_percent]) {
    return $value . '%';
  }
  else {
    return $value;
  }
}