I received the above error when rendering a layout field in a template called
<section class="container"> <?php foreach ($page->copy()->toLayouts() as $layout): ?> <div class="copy"> <?php foreach ($layout->columns() as $col): ?> <?= $col->blocks() ?> <?php endforeach ?> </div> <?php endforeach ?> </section>
Removing this code block from the template gets rid of the error. However, removing just the inner
foreach loop isn’t enough.
This means, the error is triggered by the outer
<?php foreach ($page->copy()->toLayouts() as $layout): ?> // ... <?php endforeach ?>
But what’s going on here? I don’t have another page with the same slug. Also, there’s no block snipped with the name product.
Could this be a bug?
For reference, this is the content of
title: My Product extends: layouts/default tabs: content: label: Content fields: headline: label: Headline type: text width: 1/2 subhead: label: Subhead type: text width: 1/2 lead: label: Lead type: textarea copy: type: layout layouts: - "1/1" - "1/2, 1/2" - "1/3, 1/3, 1/3" images: Label: Images type: files min: 1 uploads: image # template '/files/image'