I need to create a child page in a hook and set it to a status different to draft. But this child page needs to have status: false
because, if the site admin set this page to draft, a section in the panel will break.
Here my hook code.
'page.create:after' => function ($page) {
if ($page->template() == 'project') {
$childrenPage = $page->createChild([
'slug' => 'data',
'template' => 'data',
]);
$childrenPage->changeStatus('unlisted');
}
},
the docs says this is no possible but is there any workaround?
Thanks in advance