You are here

private function FotoramaGalleryFormatter::viewElementsCheckBoxFields in Fotorama Gallery 8

Get the value for each Checkbox field.

Return value

array Array with value for each field.

1 call to FotoramaGalleryFormatter::viewElementsCheckBoxFields()
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 366

Class

FotoramaGalleryFormatter
Plugin implementation of the 'fotorama_gallery display' formatter.

Namespace

Drupal\fotorama_gallery\Plugin\Field\FieldFormatter

Code

private function viewElementsCheckBoxFields() {
  $check_box_fields = $this->configFactory
    ->get('fotorama_gallery.settings')
    ->get('CheckBoxFields');
  $attributes = [];
  foreach ($check_box_fields as $field) {
    $value = $this
      ->getSetting($field['group'])[$field['key']];
    $value_formatted = $value ? 'true' : 'false';
    $value_boolean = $value ? 1 : 0;
    if ($field['defaultvalue'] != $value_boolean) {
      $attributes[$field['data']] = $value_formatted;
    }
  }
  return $attributes;
}