This project is read-only.

How to add an Alternate on ContentPart name, so that it works for Widget and ContentItem both.

Topics: Core, Customizing Orchard, Writing modules
Mar 4, 2015 at 8:26 AM
Edited Mar 4, 2015 at 8:33 AM
I have created a ContentPart e.g MyPart and it consist of two MediaLibraryPickerFields, a BooleanField and a TextField. I wanted to use this part as Widget and as a part of other Content Types as well. Therefore, I have made this part attachable, and also, I have made a widget using this part. I want to add a view to this MyPart so that it appears same in Widget, as well as Content Item. I have added an alternate on the base of Widget, like Widget-MyOwnWidget, but it does not work on ContentItem.

My Question is, how to add alternate so that it appears same for, Widget and Content Item both.

Or what is that best way to address this requirement. Please suggest.

Mar 5, 2015 at 5:40 PM
Does your content part have a driver? If so, then it would be easy - the shape returned from that driver would be responsible for rendering the various fields, regardless of the content type using that part.

If you don't have a codified representation of your part, then I'm not sure what the best way would be. I'd probably create one view for the widget type and another one for the other content type, who both in turn would render an ad hoc shape (e.g. "MyPart"), passing in the information it needs to render the fields.
Marked as answer by cloudsurfer on 3/5/2015 at 9:52 PM
Mar 6, 2015 at 5:57 AM
For the time being I have two created two separate views Widget and Content type. But as far as my Part is concerned, My part has no derived from ContentPart therefore I cannot override display methods. Thanks for your time spike.