I’m trying to create a kind of blog where page titles are not really used. Since the title is required for every page, I thought it might be a good idea to auto-generate it from the date. I’m wondering if this is possible.
Ah right, I see how I can use this plugin to set the title automatically by skipping the dialog.
I am just curious, though, was there something wrong with my hook? Because I would also like to automatically change a page status to listed, but $page->changeStatus('listed') does not work.
Ah right, of course. It still leads to a blank page, but I guess for the title I can just use the plugin. However, since $page->changeStatus('listed') also doesn’t work, I must be doing something wrong. I haven’t been able to find any examples in the docs of how to actually write one of these hooks, so maybe I’m looking in the wrong place.
This works! Only after the page creation, the title is changed, but the panel still tries to send me to the old page, which then is not found. Is there a way for the hook to redirect me to the new page?
This is without the plugin—just changing the title and slug with the hook that I wrote. I suppose I could leave out changing the slug so that it would still work.
Yep, I am probably going to use both—the plugin for the title/slug and the hook to change the status to listed. In any case, thank you again for all your help!
Sorry to bother you again, but I was thinking setting the title and slug as a unix timestamp would work—they would function kind of like UUIDs. So I’ve been trying to enforce this for all posts, through a page.update:after hook. However, slugs and titles do not seem to change with the code below. Am I doing something wrong?
Hm, I think using a page model which overrides the create() method probably makes more sense here than the hooks. Don’t know if it works with the before hook as suggested by @distantnative