Jump to:

5542 Posts in 1739 Topics by 1225 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Remove 'ArticlePage' from 'Page' (backend)

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

Page: 1
Go to End
Author Topic: 518 Views
  • homezonebenny
    Community Member
    3 Posts

    Remove 'ArticlePage' from 'Page' (backend) Link to this post


    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.


  • martimiz
    Forum Moderator
    1086 Posts

    Re: Remove 'ArticlePage' from 'Page' (backend) Link to this post

    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...

  • homezonebenny
    Community Member
    3 Posts

    Re: Remove 'ArticlePage' from 'Page' (backend) Link to this post

    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 ^^

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.