Using hooks within the API php file is no longer working.
'item.create.devices:before' => function (\Directus\Hook\Payload $payload) {
$payload->set('name','test');
return $payload
https://docs.directus.io/extensions/hooks.html#creating-hooks
item.create hook should allow me to set the name to test by altering the payload.
No value is set for the name text field.
@srjrol
If you check the doc, then you'll able to find out that the hook will accept the array of your input and filters will accept the object of payload.
Based on your example, It seems like you are trying to user object of payload as a hook to update your payload and that's the cause of the error at your end.
Kindly use filters to edit your payload instead of hooks.
@bjgajjar
Thanks for the suggestion. I should have been more clear in my original report as I am already using a filter hook for this. I do not have any action hooks. The hooks I have written were working for about 6-8 months but I noticed problems sometime around the World Map — (190717A) release.
@benhaynes can we get this labeled back as a bug? It is not a documentation issue unless that's to say the procedure has been changed and needs to be updated.
@srjrol,
World Map — (190717A) release
Can you please check it in the latest build? As I am not able to reproduce it in the latest one.
Not sure why you quoted the World Map release. I am already using the latest release Spouting Whale — (190807A).
I found the problem. My config.php was overwritten in one of the updates and it was no longer pointed to my custom api file :(
Most helpful comment
@benhaynes can we get this labeled back as a bug? It is not a documentation issue unless that's to say the procedure has been changed and needs to be updated.