Skip to content
Grav 2.0 is officially stable. Read the announcement →
General

Finding a way to create multiple authors with mediaselect in site.yaml

Started by Benjam 7 years ago · 0 replies · 461 views
7 years ago

Hi everyone, I would like to add the possibility of adding multiple authors, accessible via the file site.yaml.

I rewrote the blueprint in /users/blueprints/config/site.yaml, and added this configuration

YAML
auteur:
            type: section
            title: Authors
            underline: true

            fields:
                author.media:
                    type: file
                    label: Image
                    destination: 'user/themes/my-theme/images/author/'
                    multiple: true
                    filesize: 1
                    accept:
                      - image/*
                    avoid_overwriting: true

                author.list:
                    name: authorlist
                    type: list
                    label: Author(s) List
                    fields:
                        .image:
                          type: pagemediaselect
                          label: Image
                          preview_images: true
                        .firstname:
                          type: text
                          label: Firstname
                        .lastname:
                          type: text
                          label: Name
                        .email:
                          type: email
                          label: Email
                        .description:
                          type: textarea
                          label: Description
                        .facebook:
                          type: text
                          label: Facebook
                        .twitter:
                          type: text
                          label: Twitter
                        .instagram:
                          type: text
                          label: Instagram

Its works, i can add media with author.media but i cant select a special one with pagemediaselect in item list : "Cannot use "self@" outside of pages"

A solution to get around the problem?

Thx and congrat for the update, you rocks :metal:

last edited 04/13/19 by Benjam

Suggested topics

Topic Participants Replies Views Activity
General · by Hanns Mattes, 3 weeks ago
1 268 3 weeks ago
General · by Andy Miller, 3 weeks ago
0 196 3 weeks ago
General · by Jerry Hunt, 3 weeks ago
2 331 3 weeks ago
General · by pamtbaau, 3 weeks ago
1 253 3 weeks ago
General · by Andy Miller, 3 weeks ago
0 223 3 weeks ago