BrokenCode
BrokenCode

Reputation: 961

Episerver: hide a content type from showing up in the list of available blocks for main content area?

In Episerver in the main content area if you click on "create a new block" you are shown a list of blocks that can be added into this main content area.

We have created a custom block which I would like to hide from this list so that editors cannot see it.

Custom Block:

namespace Test.Site.Models.Forms
{
    [SiteImageUrl]
    [ContentType(GUID = "c9f294a0-6620-47c3-98fd-123f0fd8db8c")]
    public class CalculatorFormBlock : BaseTestCustomFormContainerBlock<GatedContentSuccessMessageBlock>
    {

    }
}

Is there a default method in Episerver to do this?

Upvotes: 1

Views: 1131

Answers (2)

Lanorkin
Lanorkin

Reputation: 7504

You can use AvailableInEditMode property (set it to false) of ContentType attribute to completely hide it from editing (also available as a checkbox in admin UI).

More details in episerver documentation.

Upvotes: 4

Asthiss
Asthiss

Reputation: 221

You can use the allowed types attribute on the main content area to only allow the blocks you want. It also works with interfaces.

Upvotes: 4

Related Questions