# Editor to blocks

**URL:** <https://forum.getkirby.com/t/editor-to-blocks/22961>\
**Category:** Questions\
**Tags:** v3\
**Created:** [July 21, 2021, 1:33pm UTC](https://forum.getkirby.com/t/editor-to-blocks/22961 "2021-07-21T13:33:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lukehatfield](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/lukehatfield/32/386_2.png) [@lukehatfield](https://forum.getkirby.com/u/lukehatfield)\
**Post date:** [July 21, 2021, 1:33pm UTC](https://forum.getkirby.com/t/editor-to-blocks/22961/1 "2021-07-21T13:33:58Z")

</div>

Changing my editor field to `type: blocks` didn’t convert the my data (maybe because I had some custom editor fields?), so I followed the [adding blocks guide](https://getkirby.com/docs/cookbook/templating/update-blocks-programmatically) to convert my editor entries to the new blocks field. However, it wasn’t till I found [this topic](https://forum.getkirby.com/t/select-fields-does-not-populate-when-creating-programatically-custom-blocks/22364) that I discovered the `->toArray()` method which allowed the conversion to finally work. So everything in this cookbook recipe worked except I had to change the last lines to…

```auto
$page->update([
  'text' => $blocks->toArray(),
]);

```

Was it because I was using `pretty:true` in my blueprint? I tried with and without that setting, but needed `toArray()` to get it to work.

Edit: don’t know if it’s related but when I tried to `dump($blocks);die;` in the recipe I got a blank screen, but when I used `dump($blocks->toArray());die;` I actually saw the data. Is my `toBlocks()` not working in this instance? I tried removing the editor plugin but didn’t seem to make a difference.
