Ethan Schofer
Ethan Schofer

Reputation: 1848

EpiServer - Restrict what blocks can go in what folders

In EpiServer 11, I want to enforce what blocks get can added to which folders under blocks. Following this article:

https://talk.alfnilsson.se/2015/12/07/creating-a-content-folder-that-only-allows-specific-content-types/

This works, but the folders can only be one level deep. That is I cant add any custom folders that reside inside other custom folders. Is there a way to control this?

Upvotes: 0

Views: 314

Answers (1)

Ethan Schofer
Ethan Schofer

Reputation: 1848

This was due to a lack of understanding about configuration. This was my folder:

[ContentType(DisplayName = "Settings Folder", GUID = "1422f7b1-a6aa-485f-a7f3-4049c9343f06", Description = "")]
[AvailableContentTypes(Availability.Specific, Include = new [] { typeof(SiteSettingsBlock), typeof(HeaderSettingsBlock), typeof(FooterSettingsBlock)})]
public class SettingsFolder : ContentFolder
{

}

All I needed to do was add Content Folder as an available type:

[ContentType(DisplayName = "Settings Folder", GUID = "1422f7b1-a6aa-485f-a7f3-4049c9343f06", Description = "")]
[AvailableContentTypes(Availability.Specific, Include = new [] { typeof(SiteSettingsBlock), typeof(HeaderSettingsBlock), typeof(FooterSettingsBlock), typeof(ContentFolder)})]
public class SettingsFolder : ContentFolder
{

}

Upvotes: 2

Related Questions