Reputation: 679
I'm working on a little Orchard CMS project and want to create a Widget to include in my Pages, from which I can add or remove items. Each of these items is a Product (small content part that displays a name, picture and short description for the item).
This Widget I want to create, should be able to add or delete products from it, without maximum or minimum limitations.
Then, how can I (in a programmatic way) create this content part that will have a collection (to put it in a way) of products?
Upvotes: 1
Views: 154
Reputation: 741
I think the problem here is semantics. A widget in Orchard is a type and it is to be used embedded in Layers
You can easily do it programatically by attaching the a part (your widget) to any other ContentItem in the part's handler.
It can be done in Migrations too and if you check the latest version 1.9x, check the Layouts feature, using an Element (you can wrap your part in it) which seems to me would be the best choice here, since it gives you more control over which "pages" should contain these products. In Layouts there is a Projection Element now, so that could help too.
There is always looking at the source. I have learnt lots from other people modules.
Upvotes: 2