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 · 497 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 Andy Miller, 2 days ago
0 70 2 days ago
General · by Veehem, 3 days ago
0 111 3 days ago
General · by milkboy, 4 days ago
0 113 4 days ago
General · by ian russell, 2 weeks ago
2 205 1 week ago
General · by pamtbaau, 1 month ago
2 462 2 weeks ago