Hello,
I’m struggling to represent a simple structure field in json, following Content Representations | Kirby CMS
Here is my default.yml :
title: Default Page
preset: page
pages: false
fields:
mandalas:
label: Mandalas
type: structure
fields:
mandala_name:
label: Name
type: text
mandala_layers:
label: Mandala layers
type: files
multiple: true
layout: cards
and my incomplete default.json.php
<?php
$json = [];
$mandalas = $page->mandalas()->toStructure();
foreach($mandalas as $mandala) {
$json[] = [
'mandala_name'=> (string)$mandala->mandala_name(),
];
// Missing code to iterate through mandala_layers and output images URLs
}
echo json_encode($json);
Thanks for your help