How to Wrap a Zone

Topics: Writing themes
Jan 28, 2012 at 12:28 AM

The only example of a wrapper I could find in a default install of Orchard was "Widget.Wrapper.cshtml".  Based on that, plus the documentation, I created a zone wrapper called "Zone-AsideSecond.Wrapper.cshtml" and gave it these contents:

@using Orchard.ContentManagement;
@using Orchard.Widgets.Models;
    <p>Just a test</p>
    <p>Another test</p>

I placed the file into "~/Themes/MyTheme/Views", but apparently it isn't being recognized because there is absolutely no change to the appearance of the site.  What am I doing wrong?

I also noticed that the theme I created has a "Zones" folder.  I had also tried to place this wrapper file there, and that didn't help either.

Jan 28, 2012 at 10:29 AM

Wrappers aren't automatically picked up. You need to implement IShapeTableEvents, catch the Zone shape, and add the wrapper. See Orchard.Core.Shapes.CoreShapes for some examples of how various shapes are modified and created.