简体   繁体   English

是否可以在EpiServer中限制页面类型的实例?

[英]Is it possible to restrict an instance of a pagetype in EpiServer?

Under Start I want the user to only have the possibility to create one instance of my EmailTemplatePage pagetype. 在开始下,我希望用户只能创建我的EmailTemplatePage页面类型的一个实例。 Is it possible? 可能吗?

You can use the AvailableContentTypes attribute on your start page type: 您可以在起始页类型上使用AvailableContentTypes属性:

[ContentType]
[AvailableContentTypes(Availability.Specific, Include = new [] { typeof(EmailTemplatePage) })]
public class StartPage : PageData
{
}

A simple solution could be that you create the single page, and then set "Available in edit mode" to false on the page type. 一个简单的解决方案是创建单个页面,然后在页面类型上将“在编辑模式下可用”设置为false。 Then it will not be possible for editors to create another page (but they can still make a copy of the existing page). 这样,编辑者将无法创建另一个页面(但是他们仍然可以复制现有页面)。

If your requirement is that an editor should be able to create just one page of a specific page type in a specific part of the page tree, you would need to create a custom validation when the page is saved. 如果您的要求是编辑者只能在页面树的特定部分中创建特定页面类型的一个页面,则在保存页面时需要创建自定义验证。

Something like this: https://blog.wsol.com/improving-episervers-content-editing-experience-through-validation 像这样的东西: https : //blog.wsol.com/improving-episervers-content-editing-experience-through-validation

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM