Reputation: 231
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
Upvotes: 1
Views: 364
Reputation: 5967
I have been working with orchard since version 1.4 and i haven't faced with this type of code to crate a widget.i think this article is out of date check this link instead to create a widget.
in a short sentence a widget is a ContentType
which has a part called WidgetPart
and has Stereotype
of Widget
.the migration for a widget would look like this :
ContentDefinitionManager.AlterTypeDefinition("FOOWidget", cfg => cfg
.WithPart("WidgetPart")
.WithPart("CommonPart")
.WithSetting("Stereotype", "Widget"));
hope this be useful.
Upvotes: 1