Site.yaml with image

Hello !

In the gateway theme, i have got in the site.yaml :
header:
title: ‘The beautiful title’
background: thebackground.jpg

in order to make it easily “customisable” , i have added in the user/blueprints/config a site.yaml with :
@extends:
@parent

form:
fields:
anothersection:
type: section
title: Mapajo
underline: true

        fields:
            header.title:
                type: text
                label: A label
                size: large
                  
            header.background:
                type: file
                label: My background                    
                destination: 'user/themes/mapajo/img'
                multiple: false
                accept:
                - image/*   

The form is working :

when i saved i got a strange message :
Twig_Error_Runtime
The merge filter only works with arrays or “Traversable”, got “string” as first argument.

if i open the site.yaml, i get :
header:
title: ‘Natura4ever - Votre distributeur’
background:
0: hero-bg.jpg
user/themes/mapajo/img/31sq6-Fond_Herbe.jpg:
name: 31sq6-Fond_Herbe.jpg
type: image/jpeg
size: 109786
path: user/themes/mapajo/img/31sq6-Fond_Herbe.jpg

if someone have the solution …

Thanks

Did you get a solution to this, I’m getting this too.

I had the same problem, I wanted to do the same as you. For anyone that comes across this issue: you probably added hero-bg.jpg manually in your yaml to test the configuration option? When you proceed to upload a file through the admin, it will be added as the second element because there your first item is already there. Grav adds a "0: " in front but doesn’t know what to do with it; it’s not a valid file upload. So simply removing that dummy setting worked for me!