benbyf Posted July 20, 2022 Share Posted July 20, 2022 Really confused about how hooks work. I'm trying to use $wire->addHookBefore("Pages::published", function(HookEvent $event) { ... } to get and change the page url before it is published how not found any way of passing the changed back. E.g. $page = $event->arguments(0); $page->name = "somename"; // now what to save the data?? my understanding is I can't use $event->return on a before hook, so how do i propergate the change? Or should I be hooking onto a function that happens before the published function is called? Link to comment Share on other sites More sharing options...
benbyf Posted July 20, 2022 Author Share Posted July 20, 2022 I poked around in the github and found a better function to hook too and actually read the comments which helped alot. now using publishReady() instead https://github.com/processwire/processwire/blob/924f93214536a506babbce1bab5c6c9e2093fc1e/wire/core/Pages.php#L2522 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now