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.

Customising the CMS /

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

Remove 'ArticlePage' from 'Page' (backend)

Go to End

3 Posts   878 Views


Community Member, 2 Posts

22 June 2011 at 10:24pm


I hope that I'm right here in this category of this forum, my "search words" didnt find anything about my questsions:

Can I remove the "ArticlePage" from the backend "create site drop down menu", if I only create a child from "Page"???
If I create a child from "ArticleHolder" I have only "ArticlePage" as the PageType, because I coding this:
public static $allowed_children = array('ArticlePage');

That you can understand what I mean i took this example from the tutorial:

I found no static propertie like:
static $allowed_parents = array();

So I think that I need to setup all allowed PageTypes (children) in Page.php, BUT if I allow "Page" as a child from "Page", I have all sup Types again (heredity).

Here a screenshoot to understand:

I tryed:
static $can_be_root = false;
this works great BUT only in the root, not as a child from "Page" >.<

Thx for your help.



Forum Moderator, 1391 Posts

23 June 2011 at 1:48am

I don't think there is such a thing as allowed_parent. There is a $default_parent in the SiteTree but that doesn't seem to do very much.

To add the Page class only and exclude all it's extensions, use the asterisk: $allowed_children = array('*Page');

To make things even more flexible you could extend the SiteTree's allowedChildren() method. This function returns an array of ClassNames used to build the create dropdown. Extending it in your Page class, you could manipulate the array and remove classes based on the current page's pagetype. Or whatever other logic you might want to add...


Community Member, 2 Posts

23 June 2011 at 3:21am

Hmmm, that produce so much overhead :-\

I try to put "ArticlePage" and "StaffPage" out of "Page" Childs. Only if the "parent" is "ArticleHolder" you can choose "ArticlePage".
All classes that exends "Page" are autom. in the SiteTree, perhaps they should not, a $add_to_tree = "true"; or something like that should do this. So you could enable this in all classes manually and remove this from "ArticlePage" and "Staffpage"...

Hmm, or a function "remove_from_tree" or something like that for the "ArticlePage / StaffPage" so that they are not in the "Page" child list, only as child of "ArticleHolder".

Argh :-D dont know ^^