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

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

General

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

Started by Benjam 7 years ago · 0 replies · 428 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 Jerry Hunt, 4 days ago
2 85 13 hours ago
General · by pamtbaau, 18 hours ago
1 60 18 hours ago
General · by Andy Miller, 1 day ago
0 47 1 day ago
General · by Marcel, 12 months ago
6 350 5 days ago
General · by Duc , 6 days ago
3 44 5 days ago