Fantomas Posted October 13, 2016 Share Posted October 13, 2016 Hi all, I'm still new to processwire and now I have to create the first hook. I need to modify the page-clone module, so there is a field in pages that has to be empty after cloning the page. How could I start this task? Link to comment Share on other sites More sharing options...
adrian Posted October 13, 2016 Share Posted October 13, 2016 What you are looking for is: Pages::cloned Take a look at @BitPoet's module: https://github.com/BitPoet/ProcessPageCloneAdaptUrls/blob/master/ProcessPageCloneAdaptUrls.module#L30 1 Link to comment Share on other sites More sharing options...
BitPoet Posted October 13, 2016 Share Posted October 13, 2016 Or, even better since it avoids a roundtrip through the database, would be Pages::cloneReady, which is called after the page is copied in memory and before it is saved to the database. Usage is the same, sans the call to $newpage->save(). I'm using Pages::cloned in my module because I need the ID of the new page which is only available after it has been saved. 6 Link to comment Share on other sites More sharing options...
Fantomas Posted October 14, 2016 Author Share Posted October 14, 2016 18 hours ago, BitPoet said: Or, even better since it avoids a roundtrip through the database, would be Pages::cloneReady, which is called after the page is copied in memory and before it is saved to the database. Usage is the same, sans the call to $newpage->save(). I'm using Pages::cloned in my module because I need the ID of the new page which is only available after it has been saved. Works perfect. Thanks! 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