Jump to content

Create pagetable page through api


fbg13
 Share

Recommended Posts

My code looks like this:

//the page
$p = new \ProcessWire\Page();
$p->template = 'template';
$p->parent   = $site->pages->get('/parent/');
$p->title    = 'title';
$p->save();

  // the child pages for the pagetable field
  $d = new \ProcessWire\Page();
  $d->template = 'template_pagetable';
  $d->parent   = $p->id;
  $d->title    = 'title';
  $d->save();

$p->save();

I get the page and it's children created, but the pagetable field doesn't have those pages set

iYuPwHY.png

instead they are displayed as a checkbox list

tGkrsXd.png

How can I add the child pages to the pageTable field?

Link to comment
Share on other sites

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
 Share

×
×
  • Create New...