Currently, it is not possible to pass $lot variable by reference due to the design of call_user_func():
// Does not work :(
Hook::set('do.page.set', function($_, &$lot) {
$lot['data']['time'] = date('Y-m-d H:i:s'); // Automatic `time` data on publish
return $_;
});
// Sometimes works :|
Hook::set('do.page.set', function($_) {
$_POST['data']['time'] = date('Y-m-d H:i:s'); // Automatic `time` data on publish
return $_;
});
Possible solution: remove the $lot parameter and simply pass it as another property of $_ variable:
Currently, it is not possible to pass
$lot
variable by reference due to the design ofcall_user_func()
:Possible solution: remove the
$lot
parameter and simply pass it as another property of$_
variable: