Jump to:

5514 Posts in 1733 Topics by 1219 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Constraining page types

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

Page: 1 2
Go to End
Author Topic: 1653 Views
  • Romeo
    Avatar
    Community Member
    67 Posts

    Re: Constraining page types Link to this post

    Useful suggestions. What would be best, of course, would be if the pop-up menu only contained the acceptable page type(s) for the page in question. In the CMS, if I have the News page selected, the page type pop-up is automatically set to ArticlePage, which is what I have as $default_child in ArticleHolder.php. But a user could still select a different type, but there is no good reason why those other types should be present in the pop-up at all. Is there some way of determining what appears in the pop-up?

    This kind of control would be really useful if a SilverStripe system needed to be administered by non-techie users (which is half of the point of a CMS, after all). As it is, I fear a lot of damage could easily be done.

  • banal
    Avatar
    Community Member
    901 Posts

    Re: Constraining page types Link to this post

    You're absolutely right. Maybe you could create a ticket (enhancement request) here: http://open.silverstripe.org/
    It would probably involve some JavaScript trickery to dynamically update the DropDown menu. Since everything that is needed is already defined with $allowed_children, I guess it's not that easy to implement, otherwise it would have been done a long time ago.

    To add to your statement: If you add something like this to your ArticleHolder.php

    public static $allowed_children = array('ArticlePage');

    The user will no longer be able to create other pages than ArticlePage inside an ArticleHolder. If he chooses something else from the dropdown, the Page will be created on level 0, not as child of the ArticleHolder. Sadly, this constraint isn't checked when one tries to change the site-type after it has been created (Behavior Tab). Still, your suggestion is a much better solution and may eventually find it's way into 2.4, since the core devs are apparently already changing a lot (if not all) of the existing JavaScript code.

    1653 Views
Page: 1 2
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.