Page.duplicate:after hook receives no arguments

If I download the current Starterkit (v3.5.6) and change the config thusly:

return [
    'debug' => true,
    'hooks' => [
        'page.duplicate:after' => function ($page) {
            var_dump($page);die;
        },
    ]
];

It returns null instead of the duplicated page in the panel.

You must receive the arguments with the same name as the documentation suggest to you

Use $duplicatePage and $originalPage.

This change from the version 3.4.0(I think :sweat_smile:) when Kirby introduced wild card hooks.

1 Like

You’re right, thanks! Is this documented somewhere? Maybe positional arguments should be disabled only if wildcard hooks are used.

Yes, here:

The main reason why we always use named arguments is consistency. Also it allows to request only specific arguments from a hook that provides many of them.

I see, thanks!