Is this possible?
Blueprint code:
fields:
content:
label: Content
type: structure
fields:
sectionBlock:
label: Sections
type: blocks
fieldsets:
- heading
- text
- image
- list
Template code:
<?php
$sections = $page->content()->toStructure();
foreach($sections as $section): ?>
<?php foreach($section->sectionBlock()->toBlocks() as $block): ?>
<div id="<?= $block->id() ?>" class="block <?= $block->type() ?> <?= $block->level() ?>">
<?= $block ?>
</div>
<?php endforeach ?>
<?php endforeach ?>
I couldn’t find a detailed example of this combo in the docs, however, it seems to display OK in the panel. See screenshots:
I think the problem is in the template code. I’m not sure how to call the block content and get it to display on the page, currently stuck with this error:
Error thrown with message "Call to a member function sectionBlock() on null"
Is there something I’m missing?
Otherwise, I’m thinking the alternative will be to make this a Nested Block instead.
Would love to hear any thoughts/advice!
Thanks