I use an update hook and I get en
even when I save a page on de
. Any ideas how to get the correct site language?
kirby()->hook('panel.page.update', function( $page ) {
debug_hook(site()->language());
});
function debug_hook($content) {
$dir = kirby()->roots()->index() . DS . 'hook.page.txt';
file_put_contents($dir, $content);
}
Works alright for me in a fresh langkit?
Edit: An alternative you can use:
kirby()->hook('panel.page.update', function( $page ) {
debug_hook($page->content()->language());
});
function debug_hook($content) {
$dir = kirby()->roots()->index() . DS . 'hook.page.txt';
file_put_contents($dir, $content);
}
1 Like
Thanks! I think it may depend on a bigger problem. I added a new question about it.
It works! But you already know that, donβt you?
Is this in the docs?
$page->content()->language();
Iβve been looked for something like it from time to time.