Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

Making a child, where is not allowed


Go to End


8 Posts   3555 Views

Avatar
xmedeko

Community Member, 94 Posts

28 May 2007 at 5:50pm

Hi,

I have a class

class BlogPost extends Page {
...
static $allowed_children = "none";
static $default_parent = "blog";
...
}

I think it should not be possible to make a child of "BlogPost" anyhow, because of $allowed_children = "none". But it is.

In the CMS->SiteContent I click "Create" and choose "Page" from the list of possible new pages. But I do not click "Go" button. Then I choose a page of my BlogPost class. Then I click "Go" button near "create", i.e. in the upper left corner. The new page is created as a child of the "BlogPost". Or at least it is shown as a child of "BlogPost" in the tree in CMS (even after browser reload).

Avatar
Sam

Administrator, 690 Posts

29 May 2007 at 8:11am

Sadly, allowed_children doesn't exist. The way the system was built it was hard to add allowed_children.

Avatar
Willr

Forum Moderator, 5523 Posts

29 May 2007 at 5:15pm

"Sadly, allowed_children doesn't exist."
I guess we should get Andy to update tutorial 2 then because this is from tutorial 2..

static $allowed_children = array('ArticlePage');

Avatar
xmedeko

Community Member, 94 Posts

29 May 2007 at 7:40pm

Avatar
msantang

Community Member, 41 Posts

29 May 2007 at 11:48pm

Edited: 30/05/2007 12:07am

I think this is a Very important Feature.

If you create a Holder page for Products for example, you need only product pages to be children of these holder.

Avatar
Sean

Forum Moderator, 922 Posts

30 May 2007 at 8:58am

I agree...

Can we not do a check on creating a new page-type on a current page, that is has the page-type you're trying to create in the static $allowed_children = array() ?

Cheers,
Sean

Avatar
Fuzz10

Community Member, 791 Posts

12 January 2008 at 3:02am

Just wanna subscribe to this thread.

I was wondering , is this feature on the roadmap ?

Avatar
schellmax

Community Member, 126 Posts

1 May 2008 at 5:41am

Edited: 01/05/2008 5:42am

although i can't find this documented anywhere, the 'allowed_children' feature now seems to be implemented in the CMS, at least in my current version (2.2.1).

when i click on a page with 'allowed_children' set, the dropdown for pagetypes automatically selects the first of my allowed_children. nevertheless, i can still select another (not allowed) page type in the list, what happens then is that in the sitetree, the selection jumps to the root ('Site Content').

i think this behaviour is a little confusing... wouldn't it be better to hide all page types aside from the allowed ones?