I have a page that has a file field. I have a custom yml file for that file field:
title: Projektbild
accept:
type: image
columns:
- width: 1/2
sections:
content:
type: fields
fields:
caption:
label: Beschreibung
type: textarea
size: medium
- width: 1/2
sections:
meta:
type: fields
fields:
alt:
label: Alternativer Text
type: text
category:
label: Kategory
type: multiselect
width: 3/3
options:
type: query
query: site.find("portfolio").children
project:
label: Projekt/Kunde
type: text
default: page.title
This is pretty much from one of the examples. That field “project” should contain as a default value the title of the page the image belongs to. I tried with a query: page.title, but that doesn’t work.
The reason why I’m doing this is listing the image, but I would also display the title of the page those images belong to:
<?php foreach ($site->find('projekte')->children()->images()->filterBy('category', $page->uri(), ',') as $img): ?>
// some code to display the images
<?php endforeach ?>