Hello Question - I'm not really sure where to look. May someone point me in the right direction to find relevant docs?
I have a field
{
name: 'location',
type: 'text',
label: "Location",
required: true,
},
And of course with the field filled out shows up as this in the API
"location": "London",
For some basic example lets say I want to return a value but is not something seen or edited in the collection for this. Is hooks where I should go? I want the result to look like such:
"location": "London",
"customHiddenStuff": "Foo",
"customHiddenNumber": "123",
etc
Where might I find docs relevant to this? Thank you
Zushi - ive used the afterRead hook for things like this. In my case i was removing some data - but no reason it couldnt also be used to add data
afterRead
is perfect for transforming data that does not need to be saved.
I'm not sure if you can add data that is not part of the schema, however.
Thank you!
Star
Discord
online
Get dedicated engineering support directly from the Payload team.