I'm trying to create a "view page" button using a UI field within the relevant collection and I'm not sure how I'm supposed to get any of the document data I need to generate the URL
Yeah I saw the documention on this hooks existence but the only valuable information I could find returned from this hook was the doc's slug, but, I need more than that.
Specifically I need the doc's slug and the id of the category it is related to so I can fetch that category and generate the URL since the URL structure is
https://mywebsite/category/slug
No I got a bunch of other values, but, none of them looked like it would give me what I needed, kinda wish the docuementation explained what some of the values are
Oh on second glance it may be the
initialData
, if not I can post the returned value, let me test this real quick though
Yup, the
initialData
gets me the docs fields and values, this is what I needed I apologize for not seeing this value during my first pass and making a post about it lol
You should be able to use Hooks to get document data
You only got the slug back?
Can I check out your usage of the hook?
I can review it with you if you post the returned value here
Sure thing
Star
Discord
online
Get dedicated engineering support directly from the Payload team.