I'm creating pages programmatically and inserting content to a Content Block but after it has been created, I can't edit it via composer (because it's not a core_page_type_composer_control_output, it's a regular content block). Is there a way to add a block to a page programmatically and have it play nice in Composer?
Relevant code I'm using:
$page = Page::getByPath('/articles/xxx');
$block = BlockType::getByHandle('content');
$data = array(
'content' => 'the content',
);
$page->addBlock($block, 'Main', $data);
To achieve this, I would setup the pagetype as you would create the page with composer.
(add the content block to composer and the standard output of the pagetype)
After creating the page, you will notice the composer-linked content block is present on the page but completely empty. Then I would update the block instead of trying to create a new block in the 'Main' area.
Code example (not tested):