Episerver:隐藏内容类型不显示在主要内容区域的可用块列表中?
Episerver: hide a content type from showing up in the list of available blocks for main content area?
在主要内容区域的 Episerver 中,如果您单击 "create a new block",您将看到可以添加到该主要内容区域的块列表。
我们创建了一个自定义块,我想将其从列表中隐藏,这样编辑者就看不到它了。
自定义方块:
namespace Test.Site.Models.Forms
{
[SiteImageUrl]
[ContentType(GUID = "c9f294a0-6620-47c3-98fd-123f0fd8db8c")]
public class CalculatorFormBlock : BaseTestCustomFormContainerBlock<GatedContentSuccessMessageBlock>
{
}
}
Episerver 中是否有默认方法来执行此操作?
您可以在主要内容区域使用 allowed types attribute 以仅允许您想要的块。它也适用于接口。
您可以使用 ContentType
属性的 AvailableInEditMode
属性(将其设置为 false)以完全隐藏它以防止编辑(也可以在管理 UI 中用作复选框).
episerver documentation 中有更多详细信息。
在主要内容区域的 Episerver 中,如果您单击 "create a new block",您将看到可以添加到该主要内容区域的块列表。
我们创建了一个自定义块,我想将其从列表中隐藏,这样编辑者就看不到它了。
自定义方块:
namespace Test.Site.Models.Forms
{
[SiteImageUrl]
[ContentType(GUID = "c9f294a0-6620-47c3-98fd-123f0fd8db8c")]
public class CalculatorFormBlock : BaseTestCustomFormContainerBlock<GatedContentSuccessMessageBlock>
{
}
}
Episerver 中是否有默认方法来执行此操作?
您可以在主要内容区域使用 allowed types attribute 以仅允许您想要的块。它也适用于接口。
您可以使用 ContentType
属性的 AvailableInEditMode
属性(将其设置为 false)以完全隐藏它以防止编辑(也可以在管理 UI 中用作复选框).
episerver documentation 中有更多详细信息。