Display custom fields in Projection widget.

Topics: Customizing Orchard
Jul 19, 2013 at 12:16 AM
I'm currently running Orchard 1.7 RC.

I'm having trouble trying to display custom fields for content types in a projection widget with a Shape layout set. I've setup the layout as shown below:


I've tried various methods in trying to get the custom field value for display, but I can't find the value anywhere.


Here is my initial code for the Shape layout
    IEnumerable<object> featuredUsers = Model.ContentItems;    

    for(int i = 0; i<featuredUsers.Count(); i++)
        dynamic featuredUser = featuredUsers.ElementAt(i);
        // Grab Field Values
        string fullname = "";
        string position = "";
        string image = "";
        string linkedin = "";
What code do I need to use to get the field values? I understand there is an option to render them out using BuildShapes, but it's not clear on how to override the individual Shape view i.e. when using @Display(shape) and to manually render out the field values.
Jul 19, 2013 at 12:35 AM
Assuming that your ProfilePart has a field named "FullName" this would be like this:
foreach(dynamic contentItem in Model.ContentItems) {
    string fullName = contentItem.ProfilePart.FullName.Value;
Jul 19, 2013 at 12:40 AM
That's the problem. I cannot grab the ProfilePart field values when I set it up through a Projection Widget. The list returns as zero. The same when I try to grab any custom fields for other content types.
Jul 19, 2013 at 1:46 AM
Looks like I was a bit blind in finding the value. Manage to find the custom field values under 'ContentItem.[ContentType]'.

Thanks for the prompt reply.

I've only just started using Orchard. I'm really liking it. The only downside is it's been a very slow learning experience.