Skip to content
Grav 2.1 is out: every page speaks Markdown. Read the announcement →

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

Started by Benjam 7 years ago · 0 replies · 555 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 lynbor, 12 hours ago
0 19 12 hours ago
General · by jeremycherfas, 5 days ago
3 120 1 day ago
General · by Old Man Umby, 3 days ago
1 70 3 days ago
General · by Sebastian, 5 days ago
1 90 5 days ago
General · by Andy Miller, 2 weeks ago
0 225 2 weeks ago