Adding Wrappers using placement info with custom Zones

Topics: Writing modules, Writing themes
Sep 23, 2014 at 8:35 PM
Edited Sep 23, 2014 at 8:42 PM
Hi, i am trying to match a specific theme that is quite flexible.

I want to add a wrapper to specific fields using

<Place Fields_Common_Text__Product-Reference="Content:after;Wrapper=ProductWrapper"/>

Then i need to render the fields in ProductWrapper Shape Template, but if i use @Display(Model), it will go thru infinite loop.

How it is supposed to be rendered properly the current Model(Shape) of the wrapper?

How i render content in a wrapper shape? i know it sounds nooby, but i really want it to make it clean and flexble.

I DO know how to do it hooking into the Model Shape object, even in Model.Metadata.ChildContent i found the inner html. Thats the clean and effective way to render the current shape inside a wrapper?

When should i use ChildContent?
Should i make Shape Morphing as done in rendering menu items?

Sep 23, 2014 at 10:45 PM
I found in Orchard.Widgets that adding a Child Shape, would avoid the circular reference. The Child shape must be rendered in the wrapper.. here is a snippet of shapes.cs in Orchard.widgets:

.OnCreated(created => {
                    var widget = created.Shape;
                    widget.Child.Add(created.New.PlaceChildContent(Source: widget));
Sep 23, 2014 at 10:48 PM
I found that very craft, tricky and heuristic.. heheh.. anyway i will do it that way!