Hello everyone,
I am using the kirby 3 page builder plugin. I struggle to call a nested field from the page builder.
I found a related topic and copied the code and adjusted it to my needs. But it won’t do anything and I get empty divs. I want to get the images and in the next step I want to call for the other infos as well (personname, persontask, etc).
<div>
<?php foreach($data->teamlist()->toBuilderBlocks() as $subBlock): ?>
<?php if($file = $subBlock->teamimages()->toFile()): ?>
<figure>
<img src="<?= $file->url() ?>" alt="">
</figure>
<?php endif ?>
<?php endforeach ?>
</div>
How the pagebuilder is called:
<?php
foreach($page->mybuilder()->toBuilderBlocks() as $block) {
snippet('blocks/' . $block->_key(), array('data' => $block));
};
?>
This is my blueprint:
type: builder
label: Teams
fields:
title:
label: Team Saison XY
type: text
width: 1/4
selectclass:
label: Team dem Archiv hinzufügen
help: Checkbox markieren, um Team zum Archiv hinzuzufügen
type: checkboxes
width: 1/4
options:
archive: archivieren
teamlist:
label: Teamliste
type: builder
fieldsets:
group:
label: Gruppe
fields:
grouptask:
label: Aufgabenbereich
type: text
teammember:
label: Mitgliederliste
type: builder
fieldsets:
member:
label: Mitglied
fields:
teamimages:
label: Portait
type: files
width: 1/4
multiple: false
personname:
label: Name
type: text
width: 1/4
persontask:
label: Aufgabenbereich
type: text
width: 1/4
personmail:
label: Emailadresse
type: link
width: 1/4
options:
- email
Extract of my contenpage (maybe this also helps):
teamlist:
-
grouptask: Aufgabenbereich
teammember:
-
teamimages:
- logo-0025-melasta.png
personname: Vanessa Schadenberg
persontask: Aufgabe
personmail:
link: hallo@vanessaschadenberg.com
type: email
_key: member
_uid: member_1560542698782_287
_key: group
_uid: group_1560542697680_217
-
I really would appreciate the help!