5450 Posts in 1672 Topics by 1197 members
|Go to End|
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:
static $can_be_root = false;
this works great BUT only in the root, not as a child from "Page" >.<
Thx for your help.
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...
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 ^^
|Go to Top|