Sep 13, 2012 at 1:29 AM
Edited Sep 13, 2012 at 1:36 AM
Fortunately I don't have to use the "get" because the Content Item Picker already has it; so I got it to work properly.
So my question is Why isn't this the best practice - how else would I be able to set and get these items and render them? I'm using a content type that I built from the Admin UI - and it's not very clear on how to override anything in code (even if
I have my own module) shapes that are built within the UI.
What if all I had was a theme and custom types built from the Admin UI - how would it be possible to use the content picker as a field to pull content? I only chose to-do this via the cshtml because I can call the below function within my cshtml file
and render the contents within the zone.
If there's a more elegant or better way to accomplish this - please help - or point me to the documentation that would help me. I'd much rather use non-code in the views; it's just not clear how to override shape rendering for ContentTypes that are
generated within the Admin UI. (since the classes aren't marked partial). So that noone reading this thread gets confused "CustomPropertiesPart.ContentItems" is the actual name of the ContentPickerField when I added it to my custom part. It's a content
picker that will allow an author to select items that will be rendered in the "Content" zone. I was doing this with Layers first - but I would have hundreds of layers for all the design types; now I don't - I accomplish the same exact thing;
but per page - and still have the ability to use zones when necessary.
@AppendShape( Model.ContentItem.CustomPropertiesPart.ContentItems, "content"
void AppendShape(ContentPickerField field, string zone)
var contentManager = WorkContext.Resolve<IContentManager>();
var items = field.ContentItems;
foreach (var item in items)
var shape = contentManager.BuildDisplay(item, "Detail");
if ( string.Equals(zone,"content", StringComparison.OrdinalIgnoreCase ) )
Any insight would be greatly appreciated.
Thanks - bill