Hey,
I’ve recently discovered the new Global Field Definitions feature - And i love it. However it doesn’t seem to be possible to use it outside the main fields
key (i.e. for files
or even files > fields
). I often add a lot of textfields (like Title, Description, Source, Source-URL, …) to Image-Files and would be so thankful if I could share these across my different blueprints.
For Reference: https://getkirby.com/docs/panel/blueprints/global-field-definitions
Dennis
Hm, I just tested this and seems to work:
Blueprint:
title: Article
files:
fields:
caption: caption
Field definition /site/blueprints/fields/caption.yml
label: Caption
type: text
Could you please post your example that does not work?
whoa, this was fast.
my blueprint where i try to embed
title: Bildergalerie
pages: false
icon: camera-retro
files:
sortable: true
type:
- image
size: 12000000
fields:
default: images-default
fields:
title:
label: Galerie-Titel
type: text
subtitle:
label: Galerie-Beschreibung
type: textarea
buttons: false
info:
label: Vorschau-Bild
type: info
text: >
Die Bilder in der Liste links können händisch sortiert werden. Das erste wird als Vorschau-Bild für die Galerie genutzt.
images-default.yaml
under blueprints/fields
title:
label: Titel
type: text
required: false
validate:
maxLength: 80
caption:
label: Beschreibung
type: textarea
buttons: false
keywords:
label: Schlagwörter
type: tags
sourceName:
label: Quelle ©
type: text
help: z.B. Name d. Fotografen
sourceLink:
label: Quellen-Link
type: url
Oh, you can’t use multiple fields in one file.
You are right, total fault on my side. Nonetheless, do you have any idea to optimize my scenario?
What do you mean with optimize? You can of course create a field definition for each field. You could also extend some of the fields if they are of the same type, but I’m not so sure that really makes such a big difference.
As i’m having a similar problem: I’m trying standardize metainfo for files to be reused and other blueprints. Unfortunately, what i’m trying doesn’t work. Am I overlooking something? Thanks!
blueprints/materiaal.yml
title: Materiaal
pages: true
fields:
title:
label: Titel
placeholder: Voeg een omschrijvende titel in.
type: text
summary:
label: Inleiding
placeholder: Schrijf hier inleidende tekst toe. Dit is niet noodzakelijk.
type: textarea
text:
label: Tekst
placeholder: Schrijf hier een tekst.
required: true
type: textarea
size: large
coverimg:
label: Coverafbeelding
type: image
width: 1/2
caption:
label: Onderschrift coverafbeelding
type: text
width: 1/2
tags:
label: tags
type: tags
files: metainfo
blueprints/fields/metainfo.yml
fields:
title:
label: Titel
type: text
caption:
label: Onderschrift
type: textarea
tags:
label: Tags
type: tags
index: all
Please see the documentation for field groups (introduced in Kirby 2.5.0).
For some reason I was constantly overlooking type: group
.
Thanks!