Creating an Alternate Part of a Content Type by Zone

Topics: Customizing Orchard
Jan 25, 2012 at 8:37 PM

Hi all,

I'm having trouble customizing Orchard to allow me to specifically overwrite the parts of a content type by zone. I need to have multiple different views of certain parts of type professional, depending on what zone the widget is placed in.

For example,

  • ContentPart+ContentType+Zone
  • Fields.Common.Text-Professional-BeforeContent.cshtml and Fields.Common.Text-Professional-Content.cshtml

Is this possible? I've tried customizing the IShapeTableProvider, as seen on http://docs.orchardproject.net/Documentation/Alternates but to no avail. 

Any help would be greatly appreciated.

Coordinator
Jan 26, 2012 at 4:28 AM

Did you try Widget Alternates and Shape Tracing?

Jan 29, 2012 at 12:38 AM

Yeah I did. However, I don't get an option to create an alternative for a Content Part by Type and Zone. 

Eg : http://imageshack.us/photo/my-images/440/orchard.png/

Coordinator
Jan 31, 2012 at 4:13 AM

What happens when you try implementing a IShapeTableProvider? Another thing to try may be to override Zone rendering to add alternates to child shapes (which are your widgets) on the fly.

Sep 13, 2013 at 7:16 PM
dear bertrandleroy,
May you help to a small code to solve this case.
I mean __how to get the zone of part_content is displayed __ to assign a customize template to it.
Ex:
builder.Describe("Fields_MediaLibraryPicker")
            .OnDisplaying(displaying => {
                if (zone == "Navigation"){
                    addTemplate("t1");
                } else if (timezone = "content"){
                    addTemplate("t2");
                }
                //How to get zone
            });
Coordinator
Sep 13, 2013 at 8:47 PM
Look at how WidgetAlternatesFactory is doing it (that's in Orchard.DesignerTools module / Widget alternates feature).