如何在 orchard cms 主题中创建 ContentPart?

How to create ContentPart in orchard cms theme?

我正在尝试设计一个 orchard 主题,其中我需要将一些 Content Part 附加到 MenuItem 以添加一些额外的信息 that.I 就像我在模块中所做的那样添加部分的过程,但奇怪的是我的视图没有得到 displayed.after 小时的调试我发现我的部分的编辑器形状(例如:Parts_MenuItemMetaPart_Edit)被添加到我的前端主题的 ShapeTable 而不是管理主题(TheAdmin) 因此我的附加部分编辑器不是 displayed.so 是否有可能从主题中创建内容部分?如果是,如何?

刚找到这个link:https://github.com/OrchardCMS/OrchardDoc/blob/master/Documentation/Add-Custom-Settings-to-your-Theme.markdown

来自上面的 link :

... You may be wondering why we don’t just use a driver like we usually do for a parts editor template. This is due to the fact that to call the Editor method of your Driver and return a shape, you need to have specified in the Placement.info that you want to do that. Since this theme is not active in the admin section of Orchard, our themes Placement.info file is never run hence a Driver would never display anything...

所以解决方案是像这样在 ContentPartHandler 中添加 ActivatingFilter

Filters.Add(new ActivatingFilter<MyPart>("Site"));

有关详细信息,请按照提供的 link 进行操作。