Question

I have extended the BlogEntry class and added three new pagetypes: -

class ResourceBlogEntry extends BlogEntry { ... }
class NewsBlogEntry extends BlogEntry { ... }
class MediaBlogEntry extends BlogEntry { ... }

They are showing up fine in the new page list when I try to add a child page of a BlogHolder. The problem is the original BlogEntry pagetype is still showing up in the list and I can't remove it. I have tried all the methods on the following page without success: -

http://www.balbus.tk/hide-a-page-from-the-cms-pagetype-dropdown/

I don't know what I am doing wrong.

FYI, this website is using SilverStripe version 3.1.

MORE INFO

I have also used a dataextension on the BlogEntry page type, I don't know if that is the problem.

class CustomBlogEntry extends DataExtension {
Was it helpful?

Solution

You do this by setting the hide_ancestor static to the name of the class you want to hide.

In this case, you'd use

class ResourceBlogEntry extends BlogEntry 
    private static $hide_ancestor = 'BlogEntry';
}

Remembering to flush after you add it.

OTHER TIPS

You can do this using the hide_ancestor flag on one of your subclasses. In SilverStripe 3.1+ you need to configure this using a private static:

class ResourceBlogEntry extends BlogEntry {
    private static $hide_ancestor = true;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top