About ContentTypeFilter

Hi! I’m using the ContentTypeFilter to create some pages based on which Content Types the user has selected on a property of this type, but since it still lacks documentation, I’m with some doubts that I hope you can help me :stuck_out_tongue:
I’ve tried to use default to select the standart content types that when the user creates a new object, they should be already selected, but didn’t worked. So, there’s any other way to set default values for this input?
Another question is about allow/deny some content types, because we want to have just some, but not things like the media:[…] or portal:[…].

Could you please provide some more context here? I don’t understand what you are talking about?

I have a part, that is a “Filter Box”, and the filters shown on that part will be different deppending the page I’m accessing. My part descriptor is:

In the “filterType” I’m using a ContentTypeFilter, which is a property to link my site Content Types (like the field “Supports” in the Template Objects.
I want to know if there’s a way of blocking some content type to appear on that input and how I can setup default values for it.

First, there is no input type called “contentTypeFilter”. Here is the current list: http://docs.enonic.com/en/stable/developer/schema/input-types/index.html

That said, you can make your own selector with your desired functionality by implementing a customSelector: http://docs.enonic.com/en/stable/developer/schema/input-types/custom-selector.html

There is also a getTypes function in the latest content lib that you could use, but I’m afraid it is not site contextual yet!

1 Like


The ContentTypeFilter is not documented and does not have all the features other documented input types have, like <default>. If such features are needed I’d suggest you follow Thomas’ suggestions for the lib-content and getType and getTypes functions in a CustomSelector.

1 Like

That should solve my question. Thanks.