Error/bug when selecting multiple images with pagemediaselect

Hi, I’ve got a problem with selecting multiple images with the pagemediaselect field. If I enable


multiple: true


in my blueprint file and then pick multiple images with it. I get this error

 [twig error](//muut.com/u/getgrav/s3/:getgrav:iAiP:knipsel.png.jpg) 

This is my complete blueprint file

extends@: default

form:
fields:
tabs:
fields:
referenties:
type: tab
title: Referenties
fields:
header.referenties:
type: list
fields:
.image:
type: pagemediaselect
label: image
multiple: true


Am I doning something wrong or is it a bug?

Hi,

From my perspective, what you want to achieve is to add several “referenties” with each having one image.

It’s what I do wiyh my showcase example below. Contributors will create n “block” for which he will select 1 image, set 1 url and set 1 text.

title: Showcase
'@extends': default

form:
  fields:
    tabs:
      fields:
        advanced:
          fields:
            columns:
              fields:
                column1:
                  fields: 
                    name:
                      default: modular/showcase
                      '@data-options': '\Grav\Common\Page\Pages::modularTypes'
            overrides:
              fields:
                header.template:
                  default: modular/showcase
                  '@data-options': '\Grav\Common\Page\Pages::modularTypes'
        buttons:
          type: tab
          title: Buttons
          fields:
            header.buttons:
              name: buttons
              type: list
              label: Buttons
              fields:
                .text:
                  type: text
                  label: Text
                .url:
                  type: text
                  label: URL
                .img:
                  label: Choose media
                  type: pagemediaselect

As it’s a type: list, you will have 0 to n occurences of this “block”. Each block will have a 3 items combination (1 text, 1 url, 1 image).

Is it what you exepect or do you exepect to add several images per “block” ?

Hi, thanks for replying.

You almost got it, except they have to be able to upload multiple images per ‘block’. So for each block 1 title and multiple images that will form a gallery.

Hi,

Ok so I didn’t meet your use case yet.

Ok, for a gallery, I just built, I used this strategy:

  • create a album_list blueprint with related template (clone of default.yaml)
  • create a album blueprint with related template (clone of default.yaml with a few custom fields to manage remote albums)

Album_list page will display all the available albums with 1 image describing the album.
In each album, each photo is a media of the page.

So quite easy :slight_smile: