I already discovered how to create a neo block programmatically from this post: How can I set a Neo field's values from my plugin/module?
However, I don't know how I can create a neo block with child blocks.
So the idea is I want something like this:
[
'blocks' => [ // Neo field handle
'new0' => [
'modified' => 1,
'type' => 'topLevel', // Top level neo block
'enabled' => 1,
'collapsed' => 0,
'level' => 0,
'fields' => [
'someField' => true, // Neo block field
],
'children' => [
'new0' => [
'modified' => 1,
'type' => 'secondLevel', // child neo block
'enabled' => 1,
'collapsed' => 0,
'level' => 0,
]
]
]
]
]
The children
array is just what I imagine the solution might be like. But this doesn't work.
Does anybody know how it should be done?
Thanks