Hi there, I’m facing a small issue while creating child pages: In a route that’s available in both default language (en => ‘/’) and a secondary language (de => ‘/de’) I’m creating a child page using the
createChild function using values that are user-submitted:
$kirby->impersonate('kirby'); $new_child = $my_page->createChild([ 'slug' => 'some-slug', 'title' => 'Some Title', 'template' => 'child_page', 'status' => 'listed', 'content' => [ 'my_field' => $sent_data['my_field'] ] ]); $new_child->publish();
Now, I need to make sure that the field value of
my_field will always be set only in the default language (en), even if the route was used while the secondary language is active. How can I use the createChild function while specifying in what language the content should be saved?
So I need to either specify the language somehow in the array passed to createChild or I need to manually activate the default language before using createChild.
I found this related thread that didn’t provide an answer.