1

My goal is to create a series of widgets for Orchard I can re-use on following projects.

With that in mind I'm able to create widgets for a particular theme utilising the migrations.cs file but have found this in the orchard docs:

http://docs.orchardproject.net/Documentation/widgets

Stating: "A widget is composed of two or more files that are placed in a /Packages/[MyPackage]/Widgets directory of the application." That would suit me better as in theory each widget would have it's own folder, manifest txt and be self contained with it's own resources.

My question is: Is that link out of date and therefore incorrect? And if not where would I add the 'packages' folder (I've tried adding it to various places inc the 'src' folder) but can't get it to work. Is creating a widget this way even possible?

Thanks in advance

4

1 回答 1

1

我从 1.4 版开始一直在使用果园,我还没有遇到过这种类型的代码来创建小部件。我认为这篇文章已经过时了,请查看这个链接来创建一个小部件。

简而言之,一个小部件是一个ContentType有一部分被称为WidgetPart 并具有Stereotype的部分Widget。小部件的迁移看起来像这样:

 ContentDefinitionManager.AlterTypeDefinition("FOOWidget", cfg => cfg
                .WithPart("WidgetPart")
                .WithPart("CommonPart")
                .WithSetting("Stereotype", "Widget"));

希望这很有用。

于 2013-07-25T16:20:30.630 回答