Jump to content

Recommended Posts

Posted

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?

Posted

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');

});

 

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...