edit Answering my own questions:
I’m a bit confused about the migration process of an existing site to 3.5 with the new block editor. Unfortunately my project used both editor and builder .
- Should I be removing
getKirby/editor
andtimoetting/kirby-builder
via composer?
Yes
- Is there a default set of snippets available anywhere?
- I’m trying to get a simple HTML representation of the entire group of blocks for use in a headless JSON endpoint. I am trying
$page->exampleField()->toHtml()
but getting:
"[{\"content\":{\"text\":\"<p>Lorem ipsum dolor sit amet<\\/p>\"},\"id\":\"a6f3bac6-6914-4d93-9d1b-8960b6bb69ef\",\"isHidden\":false,\"type\":\"text\"},{\"content\":{\"text\":\"<p>Hello World<\\/p>\"},\"id\":\"d9f5ca42-78ff-4d63-8199-eacf370d405d\",\"isHidden\":false,\"type\":\"text\"}]"
The solution was $page->exampleField()->toBlocks()->toHtml();
and $page->exampleField()->toBlocks()
results in {"a6f3bac6-6914-4d93-9d1b-8960b6bb69ef":{},"d9f5ca42-78ff-4d63-8199-eacf370d405d":{}}
If you don’t want to care about the HTML for each individual block, you can echo the entire blocks collection to render all blocks.
In /site/snippets/blocks/text.php
I have:
<p><?= kirbytext($content) ?></p>