public static function FotoramaGalleryFormatter::defaultSettings in Fotorama Gallery 8
Same name and namespace in other branches
- 8.2 src/Plugin/Field/FieldFormatter/FotoramaGalleryFormatter.php \Drupal\fotorama_gallery\Plugin\Field\FieldFormatter\FotoramaGalleryFormatter::defaultSettings()
Defines the default settings for this plugin.
Return value
array A list of default settings, keyed by the setting name.
Overrides ImageFormatter::defaultSettings
File
- src/
Plugin/ Field/ FieldFormatter/ FotoramaGalleryFormatter.php, line 87
Class
- FotoramaGalleryFormatter
- Plugin implementation of the 'fotorama_gallery display' formatter.
Namespace
Drupal\fotorama_gallery\Plugin\Field\FieldFormatterCode
public static function defaultSettings() {
$default_settings = [];
$selects_fields = \Drupal::config('fotorama_gallery.settings')
->get('SelectFields');
$check_box_fields = \Drupal::config('fotorama_gallery.settings')
->get('CheckBoxFields');
$dimensions_fields = \Drupal::config('fotorama_gallery.settings')
->get('NumberFields');
$all_fields = $selects_fields + $check_box_fields + $dimensions_fields;
/* construct $default_settings array,
* $default_settings['field-group']['key_field'] = 'defaultvalue'
*/
foreach ($all_fields as $field) {
$default_settings[$field['group']][$field['key']] = $field['defaultvalue'];
// Add percent field for all dimensions fields.
if ($field['group'] == 'dimensions') {
$default_settings['dimensions']['percent_' . $field['key']] = FALSE;
}
}
// Specials fields.
$default_settings['dimensions']['ratio'] = '';
return $default_settings + parent::defaultSettings();
}