mzur
June 26, 2021, 7:59pm
1
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 ) when Kirby introduced wild card hooks.
1 Like
mzur
June 27, 2021, 11:29am
3
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.