我试图限制编辑器在Kentico节点上创建错误的文档.我知道有页面类型 - >范围,但在我的情况下很难配置它.在我的场景中,我有一个重复的节点结构,如下所示:
Root (template: ROOT)
- Page 1 (type: Page; template: PAGE)
- Page 2 (type: Page; template: PAGE)
- Page 3 (type: Page; template: PAGE)
...
- Section A (type: Page; template: SECTION)
- Node 1 (type: Page; template: NODE)
- Node 2 (type: Page; template: NODE)
- Node 3 (type: Page; template: NODE)
...
- Section B (type: Page; template: SECTION)
- Node 1 (type: Page; template: NODE)
- Node 2 (type: Page; template: NODE)
- Node 3 (type: Page; template: NODE)
...
- Section C (type: Page; template: SECTION)
- Node 1 (type: Page; template: NODE)
- Node 2 (type: Page; template: NODE)
- Node 3 (type: Page; template: NODE)
...
Run Code Online (Sandbox Code Playgroud)
编辑器可以创建很多部分,但总是使用SECTION模板.我希望在一个部分下,编辑器只能创建一个类型为"PAGE"的节点.
这就是我要做的:我创建一个新的宏规则(在宏规则应用程序上),检查当前页面是否有特定模板(传递参数) 参见图像
然后我创建一个新的Scope(页面类型 - >范围)看图像
我认为一切都好(在"A部分"我只能添加"页面"文档),但也在"第1页"(模板与SECTION不同)我只能添加"页面"文档.似乎我的状况总是"真实"
我尝试使用"DocumentPageTemplateID"更改我的宏中的参数字段对"NodeTemplateID",但我有相同的结果.
我相信接近解决方案.你能帮助我吗?
PS:我知道我可以为A,B,C部分创建不同的页面类型,然后使用页面类型范围,但我更喜欢在模板而不是类型的基础上执行此操作.
谢谢
小智 6
不使用"页面"类型的"页面"类型,而是创建新的"页面"页面类型并为其设置默认模板.然后可能会创建另一个名为"Node"的新页面类型,并为其设置默认模板.不需要对范围感到疯狂,只需将Section和Node页面类型的范围设置为根目录,并且只允许将节点放在Sections下面,而Sections只能放在Root文档下面.