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.

Customising the CMS /

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

disable subpage creation


Go to End


3 Posts   1872 Views

Avatar
holy noli

Community Member, 6 Posts

29 March 2010 at 6:32am

Hi

I would like to remove the ability in the Sliverstripe for admin users to creating subpages. Only would like top level pages. Would appreciate if someone could point me in the right direction

thank you

Avatar
Ingo

Forum Moderator, 801 Posts

13 April 2010 at 8:45pm

put this into your Page class

static $allowed_children = array();

Haven't tested it, but should work :)

Avatar
inCharge

Community Member, 102 Posts

22 April 2010 at 8:23am

> static $allowed_children = array();

This is better than nothing, because if you click the 'Create' button with the restricted page selected, it jumps up a level and selects the parent.

However, if you select the restricted child again, you can add a sub-page.

There is no option in the page type list for 'No page can be created at this level', so I doubt it is possible to prevent a sub-page from being created without CMS enhancements.

An alternative approach would be to define a maximum menu depth somewhere. Is that currently possible?

Either way, it would be a good feature, because it is common that menus that only work to a given depth.