You are here

private function FotoramaGalleryFormatter::viewElementsSelectsFields in Fotorama Gallery 8

Get the value for each Select field.

Return value

array Array with value for each field.

1 call to FotoramaGalleryFormatter::viewElementsSelectsFields()
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 346

Class

FotoramaGalleryFormatter
Plugin implementation of the 'fotorama_gallery display' formatter.

Namespace

Drupal\fotorama_gallery\Plugin\Field\FieldFormatter

Code

private function viewElementsSelectsFields() {
  $selects_fields = $this->configFactory
    ->get('fotorama_gallery.settings')
    ->get('SelectFields');
  $attributes = [];
  foreach ($selects_fields as $field) {
    $value = $this
      ->getSetting($field['group'])[$field['key']];
    if (array_search($field['options'][$value], $field['options']) != $field['defaultvalue']) {
      $attributes[$field['data']] = $field['options'][$value];
    }
  }
  return $attributes;
}