Zeka Posted December 21, 2018 Share Posted December 21, 2018 Hi. I have a hook to Pages::saveReady that changes page name and I get warning like Changed page URL name to "doc-1103" because requested name was already taken. or Warning, the name you selected "dokument" has been changed to "doc-1104". I think that I have the same case like there https://github.com/processwire/processwire-issues/issues/648 Is it possible to somehow silence this warning? Thanks. Link to comment Share on other sites More sharing options...
adrian Posted December 21, 2018 Share Posted December 21, 2018 I am curious whether it makes a difference if you make the saveReady a "before" hook? My PageRenameOptions module does some renaming on saveReady using "before" and I don't think I have ever seen this error in this situation. I might be totally off-base here but I thought it might be worth trying. Link to comment Share on other sites More sharing options...
kongondo Posted December 21, 2018 Share Posted December 21, 2018 (edited) 1 hour ago, Zeka said: Is it possible to somehow silence this warning? Quote I've also placed that warning in a hook so that you can optionally modify it (or remove it) if you want to. https://github.com/processwire/processwire-issues/issues/648#issuecomment-410758636 Edited December 21, 2018 by kongondo 2 Link to comment Share on other sites More sharing options...
Robin S Posted December 21, 2018 Share Posted December 21, 2018 51 minutes ago, adrian said: I am curious whether it makes a difference if you make the saveReady a "before" hook? OT, but saveReady is one of those methods where before and after hooks are equivalent: https://processwire.com/api/hooks/#before_or_after Quote Some hookable methods in ProcessWire have no implementation and exist purely for you to hook. Because hooks like this exist purely "to be hooked", it doesn't matter if you hook before or after them. Examples include Pages::saveReady which is called after it's been determined the page will definitely be saved, but right before it is done. Another is Pages::saved, which is called after a page has successfully been saved. These hooks provide more certainty and less need for error checking than hooking before or after Pages::save. You may see several other specific-purpose hooks like this in ProcessWire. @Zeka, the solution @kongondo linked to will work, but if you think PW should not be giving warnings for deliberate name changes that aren't related to a sibling name clash then maybe you could add your voice the GitHub issue? The fix that Ryan applied does not seem ideal and a solution (I gave a possible one in the original issue comment) that focuses more on the specific scenario of a sibling name clash would be better I think. 5 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