View more context


I have tried both of these

  1. private static $allowed_children = array(
  2. EventPage::class,
  3. "EventPage",
  4. );

@LiamC That won’t prevent people adding EventPage’s elsewhere

suppose I can just define everything but that? no?

That just specifies which pages can be children of the current one

I usually use something like

  1. php
  2. public function canCreate($member = null, $context = [])
  3. {
  4. $parent = isset($context['Parent']) ? $context['Parent'] : null;
  5. if (!$parent || !$parent instanceof ProjectHolder) {
  6. return false;
  7. }
  8.  
  9. return parent::canCreate($member, $context);
  10. }

Right I see, brilliant. Thank you 🙂

(obviously replace ProjectHolder with whatever the parent page should be