Blocks in structures?

I have a structure with a block inside. When i retrieve the structure with
$statements = $page->references()->toStructure();
and i whant to use the block inside with
$statement->text()->toBlocks()
I get the result shown in the attached image ?!?

What i am doing wrong?

I tested a simple example without issues in 3.5.5

Could you provide your structure field blueprint definition plus the complete template snippet?

I am also using 3.5.5 an here are the code snippets:

  1. I filter the active structure elements:
<?php
    $statements = $page->references()->toStructure();

    // filter active benefits
    $active_statements = array();
    foreach ($statements as $key => $statement) {
      if ($statement->active()->isTrue()) {
        $active_statements[] = $statement;
      }
    }
?>
  1. After that i do HTML and a foreach loop:
<?php foreach ($statement->text()->toBlocks() as $block): ?>
<div id="<?= $block->id() ?>" class="block block-type-<?= $block->type() ?>">
<?= $block ?>
</div>
<?php endforeach ?>
  1. yml for structure:
                fields:
                  image:
                    extends: sections/fields/attachments/motiv
                  title:
                    label:
                      de: Titel
                      en: Title
                    type: text
                  claim:
                    label:
                      de: Kernaussage
                      en: Claim
                    type: text
                  text:
                    extends: sections/fields/blocks
                  url:
                    label:
                      de: Verlinkung
                      en: Link
                    type: url
                  active:
                    label:
                      de: aktiv
                      en: active
                    type: toggle

the block field extends an existing definition:

type: blocks
pretty: true

fieldsets:
  text:
    label: Text
    type: group
    fieldsets:
      - heading
      - text
      - list
  media:
    label: Media
    type: group
    fieldsets:
      image:
        extends: blocks/image
        fields:
          image:
            image:
              back: white
            uploads:
              template: image-document        
      - video
  code:
    label: Code
    type: group
    fieldsets:
      - code
      - markdown

The issue is caused by setting pretty: true. So for the moment you can solve this by removing this setting. It’s probably a bug.

Ok, thanks for the fast reply and for opening the bug report!