【问题标题】:Episerver: hide a content type from showing up in the list of available blocks for main content area?Episerver:隐藏内容类型以使其不显示在主要内容区域的可用块列表中?
【发布时间】:2019-06-26 19:13:05
【问题描述】:

在主内容区域的 Episerver 中,如果您单击“创建新块”,则会显示可添加到该主内容区域的块列表。

我们创建了一个自定义块,我想从这个列表中隐藏它,以便编辑者看不到它。

自定义块:

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

    }
}

Episerver 中是否有默认方法来执行此操作?

【问题讨论】:

  • 非常感谢。这就是解决方案。随意添加此作为答案,我会将其标记为解决方案。

标签: episerver


【解决方案1】:

您可以使用 ContentType 属性的 AvailableInEditMode 属性(将其设置为 false)将其完全隐藏,使其无法编辑(也可作为管理 UI 中的复选框使用)。

更多详情请见episerver documentation

【讨论】:

    【解决方案2】:

    您可以在主要内容区域使用allowed types attribute 来只允许您想要的块。它也适用于接口。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-07-17
      • 1970-01-01
      • 2020-04-14
      • 1970-01-01
      相关资源
      最近更新 更多