I am trying to add images to a page using a structure field in the panel.
Template:
<?php
// using the `toStructure()` method, we create a structure collection
$items = $page->cartoons()->toStructure();
// we can then loop through the entries and render the individual fields
foreach ($items as $item): ?>
<div class="container text-center">
<?php foreach ($item->image()->toFiles() as $image): ?>
<img class="img-fluid" src="<?= $image->crop(400)->url() ?>">
</div>
<?php endforeach ?>
Blueprint:
title: Cartoons
fields:
cartoons:
label: Bilder
type: structure
fields:
image:
label: Cartoons
type: files
This is bringing an error, what am I doing wrong?