Jump to:

5554 Posts in 1742 Topics by 1227 members

Customising the CMS

SilverStripe Forums » Customising the CMS » $allowed_children stopped working!

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1155 Views
  • imagic
    Community Member
    12 Posts

    $allowed_children stopped working! Link to this post

    Hi Guys,

    This is driving me nuts.

    Full code is

    class ProblemPage extends GardenPage
       static $allowed_children = array("Page", "QuestionPage");

       static $has_many = array (
          'Problems' => 'Problem'
       public function getCMSFields()
          $f = parent::getCMSFields();
          $f->addFieldToTab("Root.Content.Problems", new DataObjectManager(
             array('Name' => 'Name','Tags' => 'Tags', 'DOMThumbnail' => 'Thumbnail'),
          return $f;


    class ProblemPage_Controller extends GardenPage_Controller {

    All page types display in the dropdown and you are able to create any one of them.. the code has no effect.

    I'm using the latest silverstripe version. and the code was working before!

    No idea why it's not working anymore!

    If anyone could help, that would be awesome!

  • martimiz
    Forum Moderator
    1091 Posts

    Re: $allowed_children stopped working! Link to this post

    Adding a pagetype to the $allowed_children array, will add all its subclasses as well. so by adding 'Page' you effectively allow all pagetypes that extend Page. To avoid that, you need to prefix the pagetype with an *:

    static $allowed_children = array("*Page", "QuestionPage");

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.