You are here

private function FotoramaGalleryFormatter::settingsFormSelectsFields in Fotorama Gallery 8

Fill $element with the select fields information from the settings.

Parameters

array $element: Form elements.

array $url_options: Url attributes.

1 call to FotoramaGalleryFormatter::settingsFormSelectsFields()
FotoramaGalleryFormatter::settingsForm in src/Plugin/Field/FieldFormatter/FotoramaGalleryFormatter.php
Returns a form to configure settings for the formatter.

File

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

Class

FotoramaGalleryFormatter
Plugin implementation of the 'fotorama_gallery display' formatter.

Namespace

Drupal\fotorama_gallery\Plugin\Field\FieldFormatter

Code

private function settingsFormSelectsFields(array &$element, array $url_options) {
  $selects_fields = $this->configFactory
    ->get('fotorama_gallery.settings')
    ->get('SelectFields');
  foreach ($selects_fields as $field) {
    $element[$field['group']][$field['key']] = [
      '#type' => 'select',
      '#title' => $field['data'],
      '#options' => $field['options'],
      '#default_value' => $this
        ->getSetting($field['group'])[$field['key']],
      '#description' => Link::fromTextAndUrl($this
        ->t('Documentation: @field', [
        '@field' => $field['data'],
      ]), Url::fromUri($field['documentation'], $url_options)),
    ];
  }
}