webhoes Posted September 6, 2020 Share Posted September 6, 2020 Hello, I have a template that has 4 possible children. Therefor I can not use the auto child page name. I create a new page with a button on the frontend that uses this format: page/add/?parent_id=1078&template_id=87 I tried adding &title=xxx&name=xxx to it but that does not work. Also tried some hooks that also did not work. How can I automatically fill title and name upon creation of a child page? Link to comment Share on other sites More sharing options...
PWaddict Posted September 6, 2020 Share Posted September 6, 2020 Try this in your site/ready.php: // if hook "added" isn't working try "save" $this->pages->addHookAfter('added', function($event) { $page = $event->arguments[0]; if($page->template != 'your-child-template') return; $page->setAndSave('title', 'Your Title'); }); 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