Really understanding placement

Topics: Customizing Orchard, Writing modules
Dec 14, 2011 at 12:37 PM

I've created a small site using existing modules, so I understand a bit about as talked about in here.

When I made my first custom module following the tutorial, I was surprised to find its full view rendered on all screens. Eventually I figured out to do DisplayType="Detail" to filter the display to just the full page.

But now I have to confess that I have no idea where Display Types are defined for Content Types. A Blog Post has "summary" and "details" amongst other things, but where is this defined? It's not in the content type screen. Page also seems to have "details" but does it have "summary?" 

Are Display Types extendable or is there a set list somewhere (based on everything else I think I know the answer, but I can't figure out where they are defined)? 

Where does the Display Type get initiated from? For example on one screen a blog post uses a summary view, but then on another it's a detail view. I see some code in the Controller talking about summary but nothing about detail.

I'd appreciate some insight. Thanks.

Dec 15, 2011 at 9:56 AM
Edited Dec 15, 2011 at 9:59 AM

Actually there could be a DisplayType with any name; you can also define your own, very simply, as display shapes are built as following:


_contentManager.BuildDisplay(contentItem, "DisplayType");

Where _contentManager is of course an IContentManager instance, contentItem is a content item object (filled with parts), DisplayType is an arbitrary string. There are bulit-in controllers (the various ItemController classes) that build display shapes for content items this way. "Detail", "Summary", "Admin" and "SummaryAdmin" just happen to be conventions these controllers use respectively. But as I've said, in your own controller you could just use "MyDisplayType" and define a placement in your just for this specific scenario.

Dec 16, 2011 at 12:39 PM

Thanks, I'm still trying to work out how everything fits together when themes etc. are part of the picture, but this is a good start.