Blocks HTML rendering not working

Hello

I am not sure how to render the blocks properly.

My test blueprint was like this

fields:
  blocktest:
    label: Blocks
    type: blocks

According to the default snippet, I added some paragraph and in my template I am trying to render this by

<?php foreach ($page->blocktest()->toBlocks() as $block) : ?>
  <div id="<?= $block->id() ?>" class="block block-type-<?= $block->type() ?>">
    Type: <?= $block->type() // this outputs "text" ?><br>
    Content: <?= $block->text() ?>
  </div>
<?php endforeach ?>

Somehow, I am getting an error: Call to undefined method Kirby\Editor\Block::text()

What am I doing wrong?

Is the Editor plugin still present? You should remove it when using blocks

3 Likes

That was the issue – I’ve updated from 3.4 !

Thanks!

OMG, thanks!
I was desperate.