Display Media Library Picker Field image in a lists alternate item view in Orchard CMS

asp.net-mvc, orchardcms

Solution

bah - so once again this all comes down to the Placement.info file in my theme.

I added a reference to the `Fields_MediaLibraryPicker` inside my `DisplayType="Summary"` and it worked like a charm.

E.G My placement.info in my theme has this for an item in my list

<Match DisplayType="Summary">
    <Place Parts_Common_Metadata_Summary="-"/>
    <Place Parts_Title="-"/>
    <Place Fields_MediaLibraryPicker="Content:1" /> <!-- this adds the field.. -->       
</Match>

Problem

So the title pretty much says it all. I am using Orchard CMS v1.7. I have created my own content type (Product Categories) - this is essentially the same as a page though also has an extra field (Media Library Picker Field) to allow me to select and display a single image - this will be displayed on both the list item view and also the main page content. I use a projection page to display all content types "ProductCategories". This works well and as expected. I now want to display this additional image within each of the items in the list of ProductCategories when viewing the projection page. Using Shape Tracing I created an alternate for my list items. By default, this looks like this: ``` @using Orchard.Utility.Extensions; @{ if (Model.Title != null) { Layout.Title = Model.Title; } Model.Classes.Add("content-item"); var contentTypeClassName = ((string)Model.ContentItem.ContentType).HtmlClassify(); Model.Classes.Add(contentTypeClassName); var tag = Tag(Model, "article"); } @tag.StartElement <header> @Display(Model.Header) @if (Model.Meta != null) { <div class="metadata"> @Display(Model.Meta) </div> } </header> @Display(Model.Content) @if(Model.Footer != null) { <footer> @Display(Model.Footer) </footer> } @tag.EndElement ``` I am now stuck - I have no idea how I display the image that is associated to this item. I step through my code to inspect the content of the `Model` passed into my custom list item view and something strange happens... when the model is loaded in there is no `ListLogo` inside. - see first snapshot.. However, the moment i step through `@if (Model.Meta != null)` my `ListLogo` can now be found on the object, however it's still empty - as in this snapshot. How do I display the image associated to this content item - there is only 1 too. Do I need to override creation of the actual list itself? If so, can you give me pointers? Thanks in advance.

Original source