Possible to run code after setting page from invisible to visible?

https://getkirby.com/docs/developer-guide/advanced/hooks

I saw hooks mentioned in the page linked above and in some forum topics, but I’m not sure if it pertains to the issue I’m trying to resolve.

I have news posts that have a datetime field set. I want to have said field automatically grab the current date/time from the server and update itself when the page’s status is set from its default state (invisible) to visible.

Since I’ll be using filtering elsewhere on the website to only return news headlines with “visible” status marked, it’s essentially a flagging system for making sure posts don’t go up early but they can be viewed/proofed by writers/editors ahead of time.

Any idea if the hooks work with this kind of approach, and if so, which hook? I’m guessing by the sound of it, it may be panel.page.update?

Yes, that would work, and you’d have to use the panel.page.sort hook.

1 Like

Great! :slight_smile: Sorry for the late response, been busy this week. x_x

I have to setup the rest of the blueprint so I won’t be able to get to this just yet, but it’s good to know it’s possible.