You are here

private function FotoramaGalleryFormatter::viewElementsNumberFields in Fotorama Gallery 8

Get the value for each dimension field.

Return value

array Array with value for each field.

1 call to FotoramaGalleryFormatter::viewElementsNumberFields()
FotoramaGalleryFormatter::viewElements in src/Plugin/Field/FieldFormatter/FotoramaGalleryFormatter.php
Builds a renderable array for a field value.

File

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

Class

FotoramaGalleryFormatter
Plugin implementation of the 'fotorama_gallery display' formatter.

Namespace

Drupal\fotorama_gallery\Plugin\Field\FieldFormatter

Code

private function viewElementsNumberFields() {
  $dimensions_fields = $this->configFactory
    ->get('fotorama_gallery.settings')
    ->get('NumberFields');
  $attributes = [];
  foreach ($dimensions_fields as $field) {
    $value = $this
      ->getSetting('dimensions')[$field['key']];
    $value_formatted = $this
      ->getNumberFieldsValuePercent($field['key'], $field['percent']);
    if ($value) {
      $attributes[$field['data']] = $value_formatted;
    }
  }
  return $attributes;
}