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

Page type "X Page" is not allowed on the root level

Go to End

4 Posts   1534 Views


Community Member, 3 Posts

19 July 2014 at 7:12am

I can not for the life of me get a custom admin working, I've followed the docs here:

and keep getting the error:

Page type "X Page" is not allowed on the root level

I want my articles administered through the left menu and not appearing as sub pages in the site tree.

Article Holder .php

class ArticleHolder extends Page {
  private static $allowed_children = array('ArticlePage');
  private static $default_child = 'ArticlePage';

class ArticlePage extends Page {
	private static $db = array(
	'Date' => 'Date',
	'Author' => 'Text'

	private static $allowed_children = 'none';
	private static $can_be_root = false;

	public function getCMSFields() {
	    $fields = parent::getCMSFields();
	    $dateField = new DateField('Date', 'Published Date');
	    $dateField->setConfig('showcalendar', true);
	    $dateField->setConfig('dateformat', 'dd/MM/YYYY');
	    $fields->addFieldToTab('Root.Main', $dateField, 'Content');
	    $fields->addFieldToTab('Root.Main', new TextField('Author', 'Author Name'), 'Content');
	    return $fields;

	public function populateDefaults() {
	    $this->Date = date('Y-m-d');
	    $this->Author = 'Patrick';


class ArticlePage_Controller extends Page_Controller {

class ArticleAdmin extends ModelAdmin {
  private static $managed_models = array('ArticlePage'); // Can manage multiple models
  private static $url_segment = 'articles'; // Linked as /admin/products/
  private static $menu_title = 'Articles';
  private static $icon = "cms/images/treeicons/news-file.gif";

class Article extends DataObject {
   // ...
   private static $searchable_fields = array(
      'Page Name',
      // leaves out the 'Price' field, removing it from the search

Help much appreciated, once cracked I can fly through my other parts.


Community Member, 3 Posts

21 July 2014 at 7:16am

Anyone? I've been staring at existing add ons trying to see what I missing here, just to shed more light, using "Simple" theme and sub page of this appears in the menu.


Forum Moderator, 267 Posts

21 July 2014 at 2:13pm

If you are getting that "Page type "X Page" is not allowed on the root level" then it is likely to do with the "private static $can_be_root = false;".

On another note, if you want to exclude certain page types from the SiteTree you can use the module.

Hope that helps.


Community Member, 3 Posts

22 July 2014 at 12:39am

Hi Cam

Thanks for replying, I'm confused though.

Say you create a "Blog" - when you publish articles to said blog you don't want them to show in the site tree, instead the blog publishing really wants to come from a link on the left menu, click into it and add the page from there.

The problem I have is that when I add a page from there it's showing in the main navigation.

The site I am trying to build is going to be very modular, pages will be very basic to provide content the client will add, but the vast structure is defined by linking to the modules like: