Jump to content

Recommended Posts

Posted

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?

Posted

not sure if this is right, and I'm on mobile. Have you tried to add them to the field?

After all pages are created, something like $page->pagetablefield->add($childpage);

  • Like 5

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
×
×
  • Create New...