21309 Posts in 5738 Topics by 2603 members
| Go to End | ||
| Author | Topic: | 3342 Views |
-
Re: How to hide a page type from CMS

19 March 2011 at 10:19am Last edited: 7 April 2011 3:50am
No, I don't suppose it is 'the' way to do this - it's too weird to have to create a page only to remove it again - just to get rid of the parent as wel. But it did work and I hadn't found another way yet...
-
Re: How to hide a page type from CMS

7 April 2011 at 3:52am
Ok, to be complete - feeling a bit guilty I guess
: the preferred way would probably be to use the canCreate() method. Just adding it to your custom MyPage class and having it return false, would remove it from the dropdown:
class MyPage extends Page {
function canCreate($Member = null) {
return false;
}
...Because this would now prevent any user, even the admin, from creating a page of this type, you'd need to build in some conditional. One way to do this, is to create a new permission code within the SecurityAdmin, and check that against the current user.
Check out http://www.ssbits.com/snippets/2009/create-a-permission-code/ for how to create and work with permissions.
I experimented with a (simple) bit of code, where you can define a list of 'restricted' pagetypes using an array from _config.php. If anyone is interested, I'll add a link...
| 3342 Views | ||
| Go to Top |
