21489 Posts in 5783 Topics by 2622 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 245 Views |
-
How to limit pages nesting level in CMS

30 December 2011 at 3:39am
Hi all,
I need to set maximum nesting level of pages in SiteTree. For example, content manager should be able to create Page page type in SiteTree root, and as a children of pages - but it should not be possible to create pages under another pages.
I created simple function, but it doesn't work.public function canAddChildren($member = null) {
if ($this->CurrentLevel() == 1) {
return true;
} else {
return false;
}
}I used CurrentLevel() function posted by UncleCheese here:
http://www.silverstripe.org/general-questions/show/13930CurrentLevel works fine when used in getCMSFields(), but in canAddChildren() it always returns 1.
| 245 Views | ||
|
Page:
1
|
Go to Top |

