I am using blocks for the first time in a Kirby 5.0.0-beta.1 build.
I have a blocks.yml in blueprints/pages -
tabs:
blocks:
type: fields
fields:
content:
type: blocks
multiple: true
fieldsets:
text:
label: Text
type: group
fieldsets:
- heading
- text
- list
media:
label: Media
type: group
fieldsets:
- image
- video
mixed:
label: Text & Image
type: group
fieldsets:
- textimage
- twoimage
- fourimage
The blocks in ‘mixed’ all have there own blueprints under blueprints/blocks named as the fieldsets.
They also have their own templates under snippets/blocks again named as the fieldsets.
In my templates folder I have blocks.php that contains this
<?php foreach ($page->content()->toBlocks() as $block): ?>
<?php if ($block): ?>
<div id="<?= $block->id() ?>" class="block--type--<?= $block->type() ?>">
<?php snippet('blocks/' . $block->type(), ['block' => $block]) ?>
</div>
<?php endif; ?>
<?php endforeach ?>
But nothing renders on the frontend, what am I doing wrong?
I can see this in my content folder as part of the page.txt
----
Content: [{"content":{"level":"h2","text":"This Is A Heading"},"id":"0180e722-b8fb-4060-897d-451bdc95cb8f","isHidden":false,"type":"heading"},{"content":{"text":"<p>This is a block of text just here to test the blocks thingy!</p>"},"id":"5a276c52-71ba-43c6-8a94-e738966ceb8c","isHidden":false,"type":"text"}]
----